Class: Trestle::Lazy::Hash

Inherits:
Object
  • Object
show all
Includes:
Enumerable, Constantize
Defined in:
lib/trestle/lazy.rb

Instance Method Summary collapse

Methods included from Constantize

#constantize

Constructor Details

#initializeHash

Returns a new instance of Hash.



41
42
43
# File 'lib/trestle/lazy.rb', line 41

def initialize
  @hash = {}
end

Instance Method Details

#[](key) ⇒ Object



51
52
53
# File 'lib/trestle/lazy.rb', line 51

def [](key)
  constantize(@hash[key])
end

#each(&block) ⇒ Object



45
46
47
48
49
# File 'lib/trestle/lazy.rb', line 45

def each(&block)
  @hash.each do |key, value|
    yield key, constantize(value)
  end
end