Class: CShadow::DoubleAttribute
- Inherits:
-
CNativeAttribute
- Object
- Attribute
- CNativeAttribute
- CShadow::DoubleAttribute
- Defined in:
- lib/cgen/attribute.rb
Instance Attribute Summary
Attributes inherited from CNativeAttribute
Attributes inherited from Attribute
#cdecl, #check, #cvar, #dump, #free, #init, #load, #mark, #owner_class, #persists, #reader, #var, #writer
Instance Method Summary collapse
-
#initialize(*args) ⇒ DoubleAttribute
constructor
A new instance of DoubleAttribute.
Methods inherited from CNativeAttribute
Methods inherited from Attribute
Constructor Details
#initialize(*args) ⇒ DoubleAttribute
Returns a new instance of DoubleAttribute.
347 348 349 350 351 352 353 |
# File 'lib/cgen/attribute.rb', line 347 def initialize(*args) super @reader = "result = rb_float_new(shadow->#{@cvar})" @writer = "shadow->#{@cvar} = NUM2DBL(arg)" # type check and conversion @dump = "rb_ary_push(result, rb_float_new(shadow->#{@cvar}))" @load = "tmp = rb_ary_shift(from_array); shadow->#{@cvar} = NUM2DBL(tmp)" end |