Module: BinData::Struct::OrderedHash

Included in:
Snapshot
Defined in:
lib/bindata/struct.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#[]=(key, value) ⇒ Object



341
342
343
344
345
# File 'lib/bindata/struct.rb', line 341

def []=(key, value)
  @order ||= []
  @order << key
  super(key, value)
end

#eachObject



347
348
349
350
351
# File 'lib/bindata/struct.rb', line 347

def each
  keys.each do |k|
    yield [k, self[k]]
  end
end

#each_pairObject



353
354
355
356
357
# File 'lib/bindata/struct.rb', line 353

def each_pair
  each do |el|
    yield *el
  end
end

#keysObject



335
336
337
338
339
# File 'lib/bindata/struct.rb', line 335

def keys
  @order ||= []
  k = super
  @order & k
end