Class: Shoehorn::HelperMethodCall

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(view, symbol, args, block) ⇒ HelperMethodCall

Returns a new instance of HelperMethodCall.



36
37
38
39
40
41
42
# File 'lib/shoehorn/helper_collection.rb', line 36

def initialize(view, symbol, args, block)
  @view    = view
  @method  = symbol
  @options = args.extract_options!
  @args    = args
  @block   = block
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



34
35
36
# File 'lib/shoehorn/helper_collection.rb', line 34

def args
  @args
end

#methodObject

Returns the value of attribute method.



34
35
36
# File 'lib/shoehorn/helper_collection.rb', line 34

def method
  @method
end

#optionsObject

Returns the value of attribute options.



34
35
36
# File 'lib/shoehorn/helper_collection.rb', line 34

def options
  @options
end

Instance Method Details

#to_sObject



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/shoehorn/helper_collection.rb', line 44

def to_s
  args = @args
  args << @options

  if @block
    output = @view.send(@method, *args, &@block)
  else
    output = @view.send(@method, *args)
  end

  output.blank? ? nil : output.html_safe
end