Method: Operate::Command#expose
- Defined in:
- lib/operate/command.rb
#expose(presentation_data) ⇒ Object
Expose a value within a handler block to the caller. Sets attribute directly if available, or as an instance variable.
RegisterAccount.call(@form) do
on(:ok) { |user| expose(:user => user) }
end
71 72 73 74 75 76 77 78 79 |
# File 'lib/operate/command.rb', line 71 def expose(presentation_data) presentation_data.each do |attribute, value| if @caller.respond_to?("#{attribute}=") @caller.public_send("#{attribute}=", value) else @caller.instance_variable_set("@#{attribute}", value) end end end |