Class: GitFit::Source::Tally
- Inherits:
-
Object
- Object
- GitFit::Source::Tally
- Defined in:
- lib/git_fit/source/tally.rb
Constant Summary collapse
- DIGITS =
%w[零 一 二 三 四 五 六 七 八 九 十]
Instance Method Summary collapse
- #add(n = 1) ⇒ Object
-
#initialize(count = 0) ⇒ Tally
constructor
A new instance of Tally.
- #to_s ⇒ Object
Constructor Details
#initialize(count = 0) ⇒ Tally
Returns a new instance of Tally.
6 7 8 |
# File 'lib/git_fit/source/tally.rb', line 6 def initialize(count = 0) @count = count end |
Instance Method Details
#add(n = 1) ⇒ Object
10 11 12 |
# File 'lib/git_fit/source/tally.rb', line 10 def add(n = 1) @count += n end |
#to_s ⇒ Object
14 15 16 17 18 19 |
# File 'lib/git_fit/source/tally.rb', line 14 def to_s return @count.to_s if @count > 9999 chinese_numeral rescue StandardError @count.to_s end |