Class: Sanford::Worker::SummaryLine

Inherits:
Object
  • Object
show all
Defined in:
lib/sanford/worker.rb

Instance Method Summary collapse

Constructor Details

#initializeSummaryLine

Returns a new instance of SummaryLine.



104
105
106
# File 'lib/sanford/worker.rb', line 104

def initialize
  @hash = {}
end

Instance Method Details

#add(key, value) ⇒ Object



108
109
110
# File 'lib/sanford/worker.rb', line 108

def add(key, value)
  @hash[key] = value.inspect if value
end

#to_sObject

change the key’s order in the array to change the order to change the order they appear in when logged



114
115
116
117
118
# File 'lib/sanford/worker.rb', line 114

def to_s
  [ 'version', 'service', 'handler', 'status', 'duration', 'params' ].map do |key|
    "#{key}=#{@hash[key]}" if @hash[key]
  end.compact.join(" ")
end