Method: Fiddle::StructArray#initialize
- Defined in:
- lib/fiddle/struct.rb
#initialize(ptr, type, initial_values) ⇒ StructArray
Returns a new instance of StructArray.
140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/fiddle/struct.rb', line 140 def initialize(ptr, type, initial_values) @ptr = ptr @type = type @is_struct = @type.respond_to?(:entity_class) if @is_struct super(initial_values) else @size = Fiddle::PackInfo::SIZE_MAP[type] @pack_format = Fiddle::PackInfo::PACK_MAP[type] super(initial_values.collect { |v| unsigned_value(v, type) }) end end |