Sha256: 4c2dc7527e608cf1d346d62729bc67aa6dc41a1ca6cd771c9ec69ec1e5463724

Contents?: true

Size: 548 Bytes

Versions: 5

Compression:

Stored size: 548 Bytes

Contents

# frozen_string_literal: true

# ##
# Good Result
#
# Syntax: SknSuccess.call(value, 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
  end

  def payload
    if defined?(@_payload)
      @_payload
    elsif value.kind_of?(Hash)
      @_payload = SknUtils::DottedHash.new(value.to_h)
    else
      value
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
skn_utils-5.8.0 lib/skn_success.rb
skn_utils-5.7.0 lib/skn_success.rb
skn_utils-5.6.0 lib/skn_success.rb
skn_utils-5.5.0 lib/skn_success.rb
skn_utils-5.4.1 lib/skn_success.rb