Class: IDL::Type::Fixed
Constant Summary
Constants inherited from IDL::Type
Long, LongLong, Octet, Short, ULong, ULongLong, UShort
Instance Attribute Summary collapse
-
#digits ⇒ Object
readonly
Returns the value of attribute digits.
-
#scale ⇒ Object
readonly
Returns the value of attribute scale.
Instance Method Summary collapse
-
#initialize(digits = nil, scale = nil) ⇒ Fixed
constructor
A new instance of Fixed.
- #instantiate(_context) ⇒ Object
- #is_anonymous? ⇒ Boolean
- #is_template? ⇒ Boolean
- #narrow(obj) ⇒ Object
Methods inherited from IDL::Type
#is_complete?, #is_local?, #is_node?, #resolved_node, #resolved_type, #typeerror, #typename
Constructor Details
#initialize(digits = nil, scale = nil) ⇒ Fixed
Returns a new instance of Fixed.
219 220 221 222 223 |
# File 'lib/ridl/type.rb', line 219 def initialize(digits=nil, scale=nil) raise RuntimeError, "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 end |
Instance Attribute Details
#digits ⇒ Object (readonly)
Returns the value of attribute digits.
218 219 220 |
# File 'lib/ridl/type.rb', line 218 def digits @digits end |
#scale ⇒ Object (readonly)
Returns the value of attribute scale.
218 219 220 |
# File 'lib/ridl/type.rb', line 218 def scale @scale end |
Instance Method Details
#instantiate(_context) ⇒ Object
234 235 236 |
# File 'lib/ridl/type.rb', line 234 def instantiate(_context) self.is_template? ? (Type::Fixed.new(@size.instantiate(_context).value)) : self end |
#is_anonymous? ⇒ Boolean
228 229 230 |
# File 'lib/ridl/type.rb', line 228 def is_anonymous? false end |
#is_template? ⇒ Boolean
231 232 233 |
# File 'lib/ridl/type.rb', line 231 def is_template? (@size && @size.is_a?(IDL::Expression) && @size.is_template?) end |
#narrow(obj) ⇒ Object
224 225 226 227 |
# File 'lib/ridl/type.rb', line 224 def narrow(obj) #typeerror(obj) obj end |