Class: IDL::Type::Fixed
Constant Summary
Constants inherited from IDL::Type
Long, LongLong, Octet, Short, TinyShort, ULong, ULongLong, UShort, UTinyShort
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(instantiation_context) ⇒ Object
- #is_anonymous? ⇒ Boolean
- #is_template? ⇒ Boolean
- #narrow(obj) ⇒ Object
Methods inherited from IDL::Type
#is_complete?, #is_local?, #is_node?, #matches?, #resolved_node, #resolved_type, #typeerror, #typename
Constructor Details
#initialize(digits = nil, scale = nil) ⇒ Fixed
Returns a new instance of Fixed.
273 274 275 276 277 278 279 |
# File 'lib/ridl/type.rb', line 273 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.to_i @scale = scale.to_i end |
Instance Attribute Details
#digits ⇒ Object (readonly)
Returns the value of attribute digits.
271 272 273 |
# File 'lib/ridl/type.rb', line 271 def digits @digits end |
#scale ⇒ Object (readonly)
Returns the value of attribute scale.
271 272 273 |
# File 'lib/ridl/type.rb', line 271 def scale @scale end |
Instance Method Details
#instantiate(instantiation_context) ⇒ Object
294 295 296 |
# File 'lib/ridl/type.rb', line 294 def instantiate(instantiation_context) self.is_template? ? (Type::Fixed.new(@size.instantiate(instantiation_context).value)) : self end |
#is_anonymous? ⇒ Boolean
286 287 288 |
# File 'lib/ridl/type.rb', line 286 def is_anonymous? false end |
#is_template? ⇒ Boolean
290 291 292 |
# File 'lib/ridl/type.rb', line 290 def is_template? (@size && @size.is_a?(IDL::Expression) && @size.is_template?) end |
#narrow(obj) ⇒ Object
281 282 283 284 |
# File 'lib/ridl/type.rb', line 281 def narrow(obj) # typeerror(obj) obj end |