Skip to content

Commit

Permalink
Merge pull request #146 from jwillemsen/jwi-anonymousfixed
Browse files Browse the repository at this point in the history
Anonymous fixed types are not allowed
  • Loading branch information
jwillemsen authored Jan 31, 2024
2 parents b837474 + f801b1c commit 7364ca8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/ridl/type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,11 @@ class Fixed < Type
attr_reader :digits, :scale

def initialize(digits = nil, scale = nil)
raise "anonymous fixed definitions are not allowed!" if digits.nil? || scale.nil?
raise "significant digits for Fixed should be in the range 0-31" unless digits.nil? || (0..31) === digits.to_i

@digits = digits.nil? ? digits : digits.to_i
@scale = scale.nil? ? scale : scale.to_i
@digits = digits.to_i
@scale = scale.to_i
end

def narrow(obj)
Expand Down

0 comments on commit 7364ca8

Please sign in to comment.