Class: LazyGraph::ObjectNode::SymbolHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/lazy_graph/node/symbol_hash.rb

Instance Method Summary collapse

Constructor Details

#initialize(input_hash) ⇒ SymbolHash

Returns a new instance of SymbolHash.



4
5
6
7
# File 'lib/lazy_graph/node/symbol_hash.rb', line 4

def initialize(input_hash)
  super
  merge!(input_hash)
end

Instance Method Details

#[](key) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/lazy_graph/node/symbol_hash.rb', line 17

def [](key)
  case key
  when Symbol then super(key)
  when String then super(key.to_sym)
  else super(key.to_s.to_sym)
  end
end

#[]=(key, value) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/lazy_graph/node/symbol_hash.rb', line 9

def []=(key, value)
  case key
  when Symbol then super(key, value)
  when String then super(key.to_sym, value)
  else super(key.to_s.to_sym, value)
  end
end