Sha256: df1459fa1c4b7d28050e43be9a381be5731bd8f5fa0075374dd72fa22a15a13d
Contents?: true
Size: 497 Bytes
Versions: 6
Compression:
Stored size: 497 Bytes
Contents
module Npy class File def initialize(io) @streams = {} Zip::File.open_buffer(io) do |zipfile| zipfile.each do |entry| name = entry.name.sub(/\.npy\z/, "") @streams[name] = entry.get_input_stream end end @data = {} end def keys @streams.keys end def [](name) @data[name] ||= Npy.load_io(@streams[name]) if @streams[name] end def to_h keys.map { |k| [k, self[k]] }.to_h end end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
npy-0.4.0 | lib/npy/file.rb |
npy-0.3.0 | lib/npy/file.rb |
npy-0.2.0 | lib/npy/file.rb |
npy-0.1.2 | lib/npy/file.rb |
npy-0.1.1 | lib/npy/file.rb |
npy-0.1.0 | lib/npy/file.rb |