Class: Trestle::Lazy::List

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

#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