class ActionInteractor::Results
Action Interactor Results¶ ↑
Provides a Hash
like object to Action Interactors execution results.
Attributes
results[R]
Public Class Methods
new(*)
click to toggle source
# File lib/action_interactor/results.rb, line 16 def initialize(*) @results = {} end
Public Instance Methods
add(attribute, result)
click to toggle source
Add result
to the results hash.
# File lib/action_interactor/results.rb, line 21 def add(attribute, result) results[attribute.to_sym] = result end
delete(key)
click to toggle source
Delete a result for key
.
# File lib/action_interactor/results.rb, line 26 def delete(key) attribute = key.to_sym results.delete(attribute) end
each() { |attribute, results| ... }
click to toggle source
Iterates through each result key, value pair in the results hash.
# File lib/action_interactor/results.rb, line 32 def each results.each_key do |attribute| yield attribute, results[attribute] end end
method_missing(attribute, *)
click to toggle source
Calls superclass method
# File lib/action_interactor/results.rb, line 38 def method_missing(attribute, *) # Define shortcut methods for each result key. # It returns the result for the key if results.has_key?(attribute) results[attribute] else super end end