Module: Packable::Extensions::Array::ClassMethods

Defined in:
lib/packable/extensions/array.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#read_packed(io, *how) ⇒ Object



36
37
38
39
40
41
42
43
44
# File 'lib/packable/extensions/array.rb', line 36

def read_packed(io, *how)
  raise "Can't support builtin format for arrays" if (how.length == 1) && (how.first.is_a? String)
  how.inject [] do |r, options|
    repeat = options.is_a? Hash ? options.delete(:repeat) || 1 : 1
    (0...repeat).inject r do
      r << io.read(options)
    end
  end
end