Class: Wavefront::Response::Ruby

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

Direct Known Subclasses

Graphite, Highcharts, Human

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, options = {}) ⇒ Ruby

Returns a new instance of Ruby.



43
44
45
46
47
48
49
50
51
# File 'lib/wavefront/response.rb', line 43

def initialize(response, options={})
  @response = response
  @options = options

  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

#optionsObject (readonly)

Returns the value of attribute options.



41
42
43
# File 'lib/wavefront/response.rb', line 41

def options
  @options
end

#responseObject (readonly)

Returns the value of attribute response.



41
42
43
# File 'lib/wavefront/response.rb', line 41

def response
  @response
end