Class: comcom.codahalecom.codahale.metricscom.codahale.metrics.healthcom.codahale.metrics.health.HealthCheck::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/leafy/health/health_check.rb

Overview

add json serialization definition

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#data=(value) ⇒ Object (writeonly)

Sets the attribute data



6
7
8
# File 'lib/leafy/health/health_check.rb', line 6

def data=(value)
  @data = value
end

Instance Method Details

#to_json(*args) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/leafy/health/health_check.rb', line 8

def to_json( *args )
  # check if it is a Hash.json and treat it as json
  if message =~ /^{.+}$/
    msg = Leafy::Health::JsonString.new( message )
  else
    msg = message
  end
  { :healthy => healthy?, :message => @data || msg }.to_json( *args )
end