Module: BinStruct::ArrayOfIntMixin
- Included in:
- ArrayOfInt16, ArrayOfInt16le, ArrayOfInt32, ArrayOfInt32le, ArrayOfInt8
- Defined in:
- lib/bin_struct/array.rb
Overview
Mixin to define common methods to all ArrayOfInt* classes.
Instance Method Summary collapse
-
#read_from_array(ary) ⇒ void
Read data from an Array and instanciate an Int type (from set_of_klass) for each element and put it in self.
Instance Method Details
#read_from_array(ary) ⇒ void
This method returns an undefined value.
Read data from an Array and instanciate an Int type (from set_of_klass) for each element and put it in self.
305 306 307 308 309 310 311 312 |
# File 'lib/bin_struct/array.rb', line 305 def read_from_array(ary) return self if ary.empty? inner_klass = self.class.set_of_klass ary.each do |i| self << inner_klass.new(value: i) end end |