Class: Trestle::Lazy::List
- Inherits:
-
Object
- Object
- Trestle::Lazy::List
- Includes:
- Enumerable, Constantize
- Defined in:
- lib/trestle/lazy.rb
Instance Method Summary collapse
- #<<(items) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(*items) ⇒ List
constructor
A new instance of List.
Methods included from Constantize
Constructor Details
#initialize(*items) ⇒ List
Returns a new instance of List.
20 21 22 |
# File 'lib/trestle/lazy.rb', line 20 def initialize(*items) @list = items end |
Instance Method Details
#<<(items) ⇒ Object
30 31 32 |
# File 'lib/trestle/lazy.rb', line 30 def <<(items) @list += Array(items) end |
#each(&block) ⇒ Object
24 25 26 27 28 |
# File 'lib/trestle/lazy.rb', line 24 def each(&block) @list.each do |item| yield constantize(item) end end |