Sha256: 1aee1f02c0c1cb8d99cc395e1776149fe2138c301320d80ff8efe5346812340f

Contents?: true

Size: 625 Bytes

Versions: 3

Compression:

Stored size: 625 Bytes

Contents

# ##
# Good Result
#
# Syntax: SknSuccess.call(payload, message=nil, bool_code=true)
#

class SknSuccess
  attr_reader :value, :success, :message

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

  def initialize(*args)
    val, msg, rc = args
    @value = val || "Success"
    @message = msg || ''
    @success = rc.nil? ? true : 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_success.rb
skn_utils-5.1.3 lib/skn_success.rb
skn_utils-5.1.2 lib/skn_success.rb