class Actions::Base
Attributes
data[RW]
err[RW]
params[RW]
Public Class Methods
new(params = {})
click to toggle source
# File lib/actions/base.rb, line 5 def initialize(params = {}) @errors = [] @params = params end
Public Instance Methods
call(*args, &block)
click to toggle source
# File lib/actions/base.rb, line 48 def call(*args, &block) run(*args, &block) self end
err_msg()
click to toggle source
# File lib/actions/base.rb, line 18 def err_msg @err ? @err.to_s.split('_').join(' ') : '' end
error(erro, data = nil)
click to toggle source
# File lib/actions/base.rb, line 26 def error(erro, data = nil) @data = data @err = erro end
error?()
click to toggle source
# File lib/actions/base.rb, line 14 def error? !success? end
fail?()
click to toggle source
# File lib/actions/base.rb, line 22 def fail? error? end
get(attr)
click to toggle source
# File lib/actions/base.rb, line 40 def get(attr) @data && @data[attr] end
run()
click to toggle source
# File lib/actions/base.rb, line 44 def run raise NotImplementedError end
set(attr, val)
click to toggle source
# File lib/actions/base.rb, line 35 def set(attr, val) @data ||= {} @data[attr] = val end
set_data(val)
click to toggle source
# File lib/actions/base.rb, line 31 def set_data(val) @data = val end
success?()
click to toggle source
# File lib/actions/base.rb, line 10 def success? @err == nil end