class SmartCore::Operation::Result::Error::Case

@api public @since 0.1.0

Public Class Methods

new( code: SmartCore::Operation::Result::Error::Code::EMPTY_CODE, context: SmartCore::Operation::Result::Error::Context::EMPTY_CONTEXT ) click to toggle source

@param code [String, Symbol, Any] @param context [Hash, Any] @return [void]

@api private @since 0.1.0

# File lib/smart_core/operation/result/error/case.rb, line 12
def initialize(
  code: SmartCore::Operation::Result::Error::Code::EMPTY_CODE,
  context: SmartCore::Operation::Result::Error::Context::EMPTY_CONTEXT
)
  @code = SmartCore::Operation::Result::Error::Code.new(code)
  @context = SmartCore::Operation::Result::Error::Context.new(context)
end

Public Instance Methods

code() click to toggle source

@return [String, Symbol, NilClass, Any]

@api public @since 0.1.0

# File lib/smart_core/operation/result/error/case.rb, line 24
def code
  @code.identifier
end
context() click to toggle source

@return [Hash]

@api public @since 0.1.0

# File lib/smart_core/operation/result/error/case.rb, line 32
def context
  @context.data
end
to_h() click to toggle source

@return [Hash<Synbol,Any>]

@api public @since 0.1.0

# File lib/smart_core/operation/result/error/case.rb, line 40
def to_h
  { code: code, context: context }
end