class ClearLogic::ContextBuilder
Public Class Methods
call()
click to toggle source
# File lib/clear_logic/context/builder.rb, line 5 def self.call Class.new do extend ::Dry::Initializer attr_reader :args attr_accessor :catched_error, :failure_error, :service, :exit_success, :step def initialize(*args) @args = args super(*args) end def [](key) @additional_opts ||= {} @additional_opts[key] end def []=(key, value) @additional_opts ||= {} @additional_opts[key] = value end def exit_success? exit_success == true end def catched_error? !catched_error.nil? end def failure_error? !failure_error.nil? end def to_h { catched_error: catched_error, failure_error: failure_error, service: service.class, exit_success: exit_success, step: step, options: @additional_opts, args: args } end end end
new(*args)
click to toggle source
Calls superclass method
# File lib/clear_logic/context/builder.rb, line 12 def initialize(*args) @args = args super(*args) end
Public Instance Methods
[](key)
click to toggle source
# File lib/clear_logic/context/builder.rb, line 17 def [](key) @additional_opts ||= {} @additional_opts[key] end
[]=(key, value)
click to toggle source
# File lib/clear_logic/context/builder.rb, line 22 def []=(key, value) @additional_opts ||= {} @additional_opts[key] = value end
catched_error?()
click to toggle source
# File lib/clear_logic/context/builder.rb, line 31 def catched_error? !catched_error.nil? end
exit_success?()
click to toggle source
# File lib/clear_logic/context/builder.rb, line 27 def exit_success? exit_success == true end
failure_error?()
click to toggle source
# File lib/clear_logic/context/builder.rb, line 35 def failure_error? !failure_error.nil? end
to_h()
click to toggle source
# File lib/clear_logic/context/builder.rb, line 39 def to_h { catched_error: catched_error, failure_error: failure_error, service: service.class, exit_success: exit_success, step: step, options: @additional_opts, args: args } end