Class: Wavefront::Response::Ruby

Inherits:
Object
  • Object
show all
Includes:
JSON
Defined in:
lib/wavefront/response.rb

Direct Known Subclasses

Graphite, Highcharts

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Ruby

Returns a new instance of Ruby.



40
41
42
43
44
45
46
47
# File 'lib/wavefront/response.rb', line 40

def initialize(response)
  @response = response

  JSON.parse(response).each_pair do |k,v|
    self.instance_variable_set("@#{k}", v)	# Dynamically populate instance vars
    self.class.__send__(:attr_reader, k)		# and set accessors
  end
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



38
39
40
# File 'lib/wavefront/response.rb', line 38

def response
  @response
end