Class: Envirobly::Numeric
- Inherits:
-
Numeric
- Object
- Numeric
- Envirobly::Numeric
- Defined in:
- lib/envirobly/numeric.rb
Instance Method Summary collapse
-
#initialize(value, short: false) ⇒ Numeric
constructor
A new instance of Numeric.
- #to_s ⇒ Object
Constructor Details
#initialize(value, short: false) ⇒ Numeric
Returns a new instance of Numeric.
4 5 6 7 |
# File 'lib/envirobly/numeric.rb', line 4 def initialize(value, short: false) @value = value @short = short end |
Instance Method Details
#to_s ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/envirobly/numeric.rb', line 9 def to_s if @short @value.to_s.delete_suffix(".0") else "%.2f" % @value end end |