Class: Fortitude::Rails::YieldedObjectOutputter
Constant Summary
collapse
- EMPTY_RETURN_VALUE =
''.freeze
Instance Method Summary
collapse
Constructor Details
#initialize(widget, yielded_object, method_names) ⇒ YieldedObjectOutputter
5
6
7
8
9
10
11
12
|
# File 'lib/fortitude/rails/yielded_object_outputter.rb', line 5
def initialize(widget, yielded_object, method_names)
@widget = widget
@yielded_object = yielded_object
@method_names_hash = { }
method_names.each do |method_name|
@method_names_hash[method_name.to_sym] = true
end
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/fortitude/rails/yielded_object_outputter.rb', line 16
def method_missing(method_name, *args, &block)
return_value = @yielded_object.send(method_name, *args, &block)
if @method_names_hash[method_name.to_sym]
@widget.rawtext(return_value)
EMPTY_RETURN_VALUE
else
return_value
end
end
|
Instance Method Details
#respond_to?(symbol, include_all = false) ⇒ Boolean
26
27
28
|
# File 'lib/fortitude/rails/yielded_object_outputter.rb', line 26
def respond_to?(symbol, include_all = false)
@yielded_object.respond_to?(symbol, include_all)
end
|