module Tzu::RunMethods
Attributes
request_klass[R]
Public Instance Methods
command_name(value = nil)
click to toggle source
# File lib/tzu/run_methods.rb, line 20 def command_name(value = nil) if value.nil? @name ||= name.underscore.to_sym else @name = (value.presence && value.to_sym) end end
get_instance(*context)
click to toggle source
# File lib/tzu/run_methods.rb, line 15 def get_instance(*context) method = respond_to?(:build) ? :build : :new send(method, *context) end
request_object(klass)
click to toggle source
# File lib/tzu/run_methods.rb, line 28 def request_object(klass) @request_klass = klass end
run(params, *context, &block)
click to toggle source
# File lib/tzu/run_methods.rb, line 5 def run(params, *context, &block) result = get_instance(*context).run(params) return result.handle(&block) if block result end
run!(params, *context)
click to toggle source
# File lib/tzu/run_methods.rb, line 11 def run!(params, *context) get_instance(*context).run!(params) end