Class: Integer
- Inherits:
-
Object
- Object
- Integer
- Defined in:
- lib/rips/utils.rb
Instance Method Summary collapse
Instance Method Details
#to_bin(width) ⇒ Object
2 3 4 5 6 7 8 |
# File 'lib/rips/utils.rb', line 2 def to_bin(width) if self < 0 '%0*b' % [width, (2**width-1) - ~self] else '%0*b' % [width, self] end end |