Exception: Fortitude::Errors::BlockPassedToNeedMethod

Inherits:
Base
  • Object
show all
Defined in:
lib/fortitude/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(widget, method_name) ⇒ BlockPassedToNeedMethod

Returns a new instance of BlockPassedToNeedMethod.



19
20
21
22
23
24
25
26
27
28
# File 'lib/fortitude/errors.rb', line 19

def initialize(widget, method_name)
  super(%{You passed a block to a method that's a 'needs' method of a Fortitude widget, #{widget}. } +
    %{This can mean you've declared a 'need' with the same name as a Fortitude tag method (e.g., "needs :#{method_name}"), } +
    %{and think you're calling the method that will generate that tag, when you're actually calling a method } +
    %{that will ignore the block you passed and just return the value of that 'need'. If that is the case, try } +
    %{calling the tag with 'tag_' prefixed to it (e.g., 'tag_#{method_name}'), which does the same thing; if not, remove } +
    %{the block and try again.})
  @widget = widget
  @method_name = method_name
end

Instance Attribute Details

#method_nameObject (readonly)

Returns the value of attribute method_name.



17
18
19
# File 'lib/fortitude/errors.rb', line 17

def method_name
  @method_name
end

#widgetObject (readonly)

Returns the value of attribute widget.



17
18
19
# File 'lib/fortitude/errors.rb', line 17

def widget
  @widget
end