https://github.com/bodacious/binary
A to_binary library for Ruby integers
https://github.com/bodacious/binary
Last synced: 9 days ago
JSON representation
A to_binary library for Ruby integers
- Host: GitHub
- URL: https://github.com/bodacious/binary
- Owner: Bodacious
- Created: 2011-09-07T18:11:59.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2023-11-14T09:40:17.000Z (over 2 years ago)
- Last Synced: 2025-11-21T18:02:25.211Z (7 months ago)
- Language: Ruby
- Homepage:
- Size: 1.95 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Convert Ruby Integers to Binary
## Note
This library probably isn't necesary. You can use `#to_s(2)` to achieve the same result.
``` ruby
3.to_s(2).rjust(8, '0')
```
---
Simple:
``` ruby
3.to_binary # => "00000011"
```