Class: GoogleMapsAPI::Core::Metric
- Inherits:
-
Object
- Object
- GoogleMapsAPI::Core::Metric
- Defined in:
- lib/google_maps_api/core/metric.rb
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(text, value) ⇒ Metric
constructor
A new instance of Metric.
- #to_i ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(text, value) ⇒ Metric
Returns a new instance of Metric.
4 5 6 7 |
# File 'lib/google_maps_api/core/metric.rb', line 4 def initialize(text, value) @text = text.to_s @value = value.to_i end |
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
2 3 4 |
# File 'lib/google_maps_api/core/metric.rb', line 2 def text @text end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
2 3 4 |
# File 'lib/google_maps_api/core/metric.rb', line 2 def value @value end |
Class Method Details
.from_hash(hash) ⇒ Object
17 18 19 |
# File 'lib/google_maps_api/core/metric.rb', line 17 def self.from_hash(hash) self.new(hash["text"], hash["value"]) end |
Instance Method Details
#to_i ⇒ Object
13 14 15 |
# File 'lib/google_maps_api/core/metric.rb', line 13 def to_i value end |
#to_s ⇒ Object
9 10 11 |
# File 'lib/google_maps_api/core/metric.rb', line 9 def to_s text end |