class ActionAction::Base
Attributes
message[R]
params[R]
result[R]
status[R]
Public Class Methods
new(params = {})
click to toggle source
# File lib/action_action/base.rb, line 11 def initialize(params = {}) @params = params @params.map do |parameter, value| instance_variable_set(:"@#{parameter}", value) end end
perform(*args)
click to toggle source
# File lib/action_action/base.rb, line 33 def perform(*args) new.perform_with_callbacks(*args) end
perform!(*args)
click to toggle source
# File lib/action_action/base.rb, line 37 def perform!(*args) if (context = perform(*args)).success? return context end raise ActionAction::Error.new(context.message) end
require(params = {})
click to toggle source
# File lib/action_action/base.rb, line 21 def require(params = {}) Parameters.new(self).require(params) end
set(params = {})
click to toggle source
# File lib/action_action/base.rb, line 28 def set(params = {}) Parameters.new(self, params).set(params) end
Also aliased as: with
Public Instance Methods
perform(*args)
click to toggle source
# File lib/action_action/base.rb, line 45 def perform(*args) perform_with_callbacks(*args) end
perform_with_callbacks(*args)
click to toggle source
# File lib/action_action/base.rb, line 55 def perform_with_callbacks(*args) run_callbacks :perform do perform_without_callbacks(*args) end self end
perform_without_callbacks(*args)
click to toggle source
# File lib/action_action/base.rb, line 49 def perform_without_callbacks(*args) @result = perform(*args) success! if @status.nil? @result end