Class: Jekyll::TallyTags::Methods
- Inherits:
-
Object
- Object
- Jekyll::TallyTags::Methods
- Defined in:
- lib/jekyll-tally-tags/methods.rb
Class Method Summary collapse
- .div(a, b) ⇒ Object
- .mul(a, b) ⇒ Object
- .sub(a, b) ⇒ Object
- .sum(a, b) ⇒ Object
- .to_f_s(number) ⇒ Object
Class Method Details
.div(a, b) ⇒ Object
17 18 19 |
# File 'lib/jekyll-tally-tags/methods.rb', line 17 def self.div(a, b) self.to_f_s(a.to_f / b.to_f) end |
.mul(a, b) ⇒ Object
23 24 25 |
# File 'lib/jekyll-tally-tags/methods.rb', line 23 def self.mul(a, b) self.to_f_s(a.to_f * b.to_f) end |
.sub(a, b) ⇒ Object
29 30 31 |
# File 'lib/jekyll-tally-tags/methods.rb', line 29 def self.sub(a, b) self.to_f_s(a.to_f - b.to_f) end |
.sum(a, b) ⇒ Object
11 12 13 |
# File 'lib/jekyll-tally-tags/methods.rb', line 11 def self.sum(a, b) self.to_f_s(a.to_f + b.to_f) end |
.to_f_s(number) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/jekyll-tally-tags/methods.rb', line 34 def self.to_f_s(number) if number - number.round != 0 number.round(2).to_s else number.round.to_s end end |