Sha256: 3aa7d1ef13dc0cd2baa3e4387946b5b21ca385cdab5114a0656db8823f16082c

Contents?: true

Size: 626 Bytes

Versions: 3

Compression:

Stored size: 626 Bytes

Contents

# ##
# Bad Result
#
# Syntax: SknFailure.call(payload, message=nil, bool_code=false)
#

class SknFailure
  attr_reader :value, :success, :message

  def self.call(*args)
    new(*args)
  end

  def initialize(*args)
    val, msg, rc = args
    @value = val || "Failure"
    @message = msg || ''
    @success = rc.nil? ? false : rc
    @_payload = val.kind_of?(Hash) ? SknUtils::DottedHash.new(val) : nil
    # puts "#{self.class.name} => val:#{val}, rc:#{rc}, msg:#{msg}, args:#{args}"
    # puts "#{self.class.name} => @val:#{@value}, @rc:#{@success}, @msg:#{@message}"
  end

  def payload
    @_payload || @value
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
skn_utils-5.2.0 lib/skn_failure.rb
skn_utils-5.1.3 lib/skn_failure.rb
skn_utils-5.1.2 lib/skn_failure.rb