class Gallus::Payload

Internal: To improve performance, context can provide values wrapped in lambdas. Those will be executed at the time of writing log. Getting the values from lambdas is the job of this simple payload class.

Public Class Methods

new(payload) click to toggle source
# File lib/gallus/payload.rb, line 13
def initialize(payload)
  @h = payload.inject({}) do |res,(k,v)|
    res[k.to_sym] = v.is_a?(Proc) ? v.call : v
    res
  end
end

Public Instance Methods

inspect() click to toggle source
# File lib/gallus/payload.rb, line 24
def inspect
  @h.map { |k,v| "#{k}=#{v.inspect}" }.join(" ")
end
to_h() click to toggle source
# File lib/gallus/payload.rb, line 20
def to_h
  @h
end