Module: Numeric::NumericExtensions

Included in:
Numeric
Defined in:
lib/libmatty/numeric.rb

Instance Method Summary collapse

Instance Method Details

#cap(limit) ⇒ Object

This HAS TO BE in the library somewhere already, but: give a fixnum, cap it at some number (ie, max(x, y) -> x). 10.cap(9) => 9.



5
# File 'lib/libmatty/numeric.rb', line 5

def cap(limit); self > limit ? limit : self; end

#pack(arg) ⇒ Object

shortcut for packing a single number…



8
# File 'lib/libmatty/numeric.rb', line 8

def pack(arg) ; [self].pack(arg) ; end