Class: DrLight::ScientificNumber
- Inherits:
-
Object
- Object
- DrLight::ScientificNumber
- Defined in:
- lib/dr_light/scientific_number.rb,
lib/dr_light/scientific_number/formatter.rb
Overview
Number to be exibed in scientific number
Defined Under Namespace
Classes: Formatter
Instance Attribute Summary collapse
- #deviance ⇒ Object readonly
- #value ⇒ Object readonly
Instance Method Summary collapse
-
#initialize(value, deviance = 0) ⇒ ScientificNumber
constructor
A new instance of ScientificNumber.
-
#to_s ⇒ Object
string representation of number.
Constructor Details
#initialize(value, deviance = 0) ⇒ ScientificNumber
Returns a new instance of ScientificNumber.
14 15 16 17 |
# File 'lib/dr_light/scientific_number.rb', line 14 def initialize(value, deviance = 0) @value = value @deviance = deviance end |
Instance Attribute Details
#deviance ⇒ Object (readonly)
10 11 12 |
# File 'lib/dr_light/scientific_number.rb', line 10 def deviance @deviance end |
#value ⇒ Object (readonly)
10 11 12 |
# File 'lib/dr_light/scientific_number.rb', line 10 def value @value end |
Instance Method Details
#to_s ⇒ Object
string representation of number
20 21 22 23 24 25 26 27 |
# File 'lib/dr_light/scientific_number.rb', line 20 def to_s format( formatter.format_string, value: formatter.value, exponential: formatter.exponential, deviance: formatter.deviance ) end |