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



383
384
385
# File 'lib/bindata/struct.rb', line 383

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

Instance Method Details

#[](key) ⇒ Object



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

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

#[]=(key, value) ⇒ Object



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

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

#has_key?(key) ⇒ Boolean

Returns:

  • (Boolean)


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

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

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

Returns:

  • (Boolean)


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

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