Class: BinData::Struct::Snapshot

Inherits:
Hash
  • Object
show all
Includes:
OrderedHash
Defined in:
lib/bindata/struct.rb

Overview

A hash that can be accessed via attributes.

Instance Method Summary collapse

Methods included from OrderedHash

#each, #each_pair, #keys

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(symbol, *args) ⇒ Object



379
380
381
# File 'lib/bindata/struct.rb', line 379

def method_missing(symbol, *args)
  self[symbol] || super
end

Instance Method Details

#[](key) ⇒ Object



365
366
367
# File 'lib/bindata/struct.rb', line 365

def [](key)
  super(key.to_s)
end

#[]=(key, value) ⇒ Object



369
370
371
372
373
# File 'lib/bindata/struct.rb', line 369

def []=(key, value)
  if value != nil
    super(key.to_s, value)
  end
end

#has_key?(key) ⇒ Boolean

Returns:

  • (Boolean)


361
362
363
# File 'lib/bindata/struct.rb', line 361

def has_key?(key)
  super(key.to_s)
end

#respond_to?(symbol, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


375
376
377
# File 'lib/bindata/struct.rb', line 375

def respond_to?(symbol, include_private = false)
  has_key?(symbol) || super
end