Class: Wintr::WeightedDigitArray
- Inherits:
-
Object
- Object
- Wintr::WeightedDigitArray
- Defined in:
- lib/wintr/weighted_digit_array.rb
Instance Method Summary collapse
- #digit_array_in_words ⇒ Object
-
#initialize(digit_array, power_of_thousand) ⇒ WeightedDigitArray
constructor
A new instance of WeightedDigitArray.
- #power_of_thousand_in_words ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(digit_array, power_of_thousand) ⇒ WeightedDigitArray
Returns a new instance of WeightedDigitArray.
5 6 7 |
# File 'lib/wintr/weighted_digit_array.rb', line 5 def initialize(digit_array, power_of_thousand) @digit_array, @power_of_thousand = digit_array, power_of_thousand end |
Instance Method Details
#digit_array_in_words ⇒ Object
13 14 15 |
# File 'lib/wintr/weighted_digit_array.rb', line 13 def digit_array_in_words DigitArray.new(@digit_array).to_s end |
#power_of_thousand_in_words ⇒ Object
17 18 19 |
# File 'lib/wintr/weighted_digit_array.rb', line 17 def power_of_thousand_in_words POWER_OF_THOUSAND[@power_of_thousand] if digit_array_in_words != '' end |
#to_s ⇒ Object
9 10 11 |
# File 'lib/wintr/weighted_digit_array.rb', line 9 def to_s [digit_array_in_words, power_of_thousand_in_words].join(' ').strip end |