Class: Shoehorn::HelperCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/shoehorn/helper_collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(view) ⇒ HelperCollection

Returns a new instance of HelperCollection.



5
6
7
8
# File 'lib/shoehorn/helper_collection.rb', line 5

def initialize(view)
  @view = view
  @calls = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(symbol, *args, &block) ⇒ Object



10
11
12
# File 'lib/shoehorn/helper_collection.rb', line 10

def method_missing(symbol, *args, &block)
  @calls << HelperMethodCall.new(@view, symbol, args, block)
end

Instance Attribute Details

#callsObject

Returns the value of attribute calls.



3
4
5
# File 'lib/shoehorn/helper_collection.rb', line 3

def calls
  @calls
end

#viewObject

Returns the value of attribute view.



3
4
5
# File 'lib/shoehorn/helper_collection.rb', line 3

def view
  @view
end

Instance Method Details

#[](x) ⇒ Object



20
21
22
# File 'lib/shoehorn/helper_collection.rb', line 20

def [](x)
  @calls[x]
end

#eachObject



14
15
16
17
18
# File 'lib/shoehorn/helper_collection.rb', line 14

def each
  @calls.each do |c|
    yield c
  end
end

#shiftObject



28
29
30
# File 'lib/shoehorn/helper_collection.rb', line 28

def shift
  @calls.shift
end

#sizeObject



24
25
26
# File 'lib/shoehorn/helper_collection.rb', line 24

def size
  @calls.size
end