Class: Ambito::Variation
- Inherits:
-
Object
- Object
- Ambito::Variation
- Defined in:
- lib/ambito/variation.rb
Constant Summary collapse
- TRENDS =
{up: "📈", down: "📉", equal: "📊"}.freeze
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(value) ⇒ Variation
constructor
A new instance of Variation.
- #to_s ⇒ Object
- #trend ⇒ Object
Constructor Details
#initialize(value) ⇒ Variation
Returns a new instance of Variation.
7 8 9 |
# File 'lib/ambito/variation.rb', line 7 def initialize(value) @value = parse(value) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
5 6 7 |
# File 'lib/ambito/variation.rb', line 5 def value @value end |
Class Method Details
.[](value) ⇒ Object
32 33 34 |
# File 'lib/ambito/variation.rb', line 32 def [](value) new(value) end |
Instance Method Details
#to_s ⇒ Object
11 12 13 |
# File 'lib/ambito/variation.rb', line 11 def to_s sprintf("%.2f" % value) << "%" end |