Class: Numeric
- Defined in:
- lib/rmtools/core/b.rb,
lib/rmtools/core/numeric.rb
Instance Method Summary collapse
- #b ⇒ Object
- #between(min, max) ⇒ Object
- #ceil_to(i) ⇒ Object
- #floor_to(i) ⇒ Object
- #hex ⇒ Object
- #mult_of(subj) ⇒ Object
- #round_to(i) ⇒ Object
Instance Method Details
#b ⇒ Object
12 |
# File 'lib/rmtools/core/b.rb', line 12 def b; !zero? && self end |
#between(min, max) ⇒ Object
16 17 18 |
# File 'lib/rmtools/core/numeric.rb', line 16 def between(min, max) min < self and self < max end |
#ceil_to(i) ⇒ Object
4 5 6 |
# File 'lib/rmtools/core/numeric.rb', line 4 def ceil_to(i) self + i - self%i end |
#floor_to(i) ⇒ Object
8 9 10 |
# File 'lib/rmtools/core/numeric.rb', line 8 def floor_to(i) self - self%i end |
#hex ⇒ Object
24 25 26 |
# File 'lib/rmtools/core/numeric.rb', line 24 def hex sprintf "%x", self end |
#mult_of(subj) ⇒ Object
20 21 22 |
# File 'lib/rmtools/core/numeric.rb', line 20 def mult_of(subj) self%subj == 0 end |
#round_to(i) ⇒ Object
12 13 14 |
# File 'lib/rmtools/core/numeric.rb', line 12 def round_to(i) [ceil_to(i), floor_to(i)].max end |