Class: Wintr::DigitGroup
- Inherits:
-
Object
- Object
- Wintr::DigitGroup
- Defined in:
- lib/wintr/digit_group.rb
Instance Method Summary collapse
-
#initialize(digits) ⇒ DigitGroup
constructor
A new instance of DigitGroup.
- #to_w ⇒ Object
Constructor Details
#initialize(digits) ⇒ DigitGroup
Returns a new instance of DigitGroup.
7 8 9 |
# File 'lib/wintr/digit_group.rb', line 7 def initialize(digits) @digits = digits end |
Instance Method Details
#to_w ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/wintr/digit_group.rb', line 11 def to_w case @digits.size when 1 OneDigitGroup.new(@digits[0]).to_w when 2 TwoDigitGroup.new(@digits[0], @digits[1]).to_w when 3 ThreeDigitGroup.new(@digits[0], @digits[1], @digits[2]).to_w end end |