Class: CShadow::BooleanAttribute
- Inherits:
-
CNativeAttribute
- Object
- Attribute
- CNativeAttribute
- CShadow::BooleanAttribute
- 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) ⇒ BooleanAttribute
constructor
A new instance of BooleanAttribute.
Methods inherited from CNativeAttribute
Methods inherited from Attribute
Constructor Details
#initialize(*args) ⇒ BooleanAttribute
Returns a new instance of BooleanAttribute.
312 313 314 315 316 317 318 319 |
# File 'lib/cgen/attribute.rb', line 312 def initialize(*args) super @cdecl = @cdecl.sub(@match[1], "int") @reader = "result = shadow->#{@cvar} ? Qtrue : Qfalse" @writer = "shadow->#{@cvar} = RTEST(arg)" # type conversion @dump = "rb_ary_push(result, shadow->#{@cvar} ? Qtrue : Qfalse)" @load = "tmp = rb_ary_shift(from_array); shadow->#{@cvar} = RTEST(tmp)" end |