Class: Trestle::Lazy::Hash
- Inherits:
-
Object
- Object
- Trestle::Lazy::Hash
- Includes:
- Enumerable, Constantize
- Defined in:
- lib/trestle/lazy.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize ⇒ Hash
constructor
A new instance of Hash.
Methods included from Constantize
Constructor Details
#initialize ⇒ Hash
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 |