bits_in_bytes 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +57 -57
- data/lib/core/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35eb08bcf54f9964566197e1dd1dae9ebb8a50f0e1dd9f4b9b71281838cecc2e
|
4
|
+
data.tar.gz: b7eadbd9d858abb8b9b8690eff2fae1319c00628392ec7b8972aea1199fb2f45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a371b898bf59fa12a1c61f8628c6fdb31dc9bbcf7a37f9c258f9fad1966d1a469a49b6f09c24bd911fe9ba17ee711c499e45c93b26ee4f8fa8cb48207017fe4
|
7
|
+
data.tar.gz: 2bf31f73292dce17a80a4998b9efb719e9895d75d2ba83a1504790137f29c5acc344d33909d76c829c2b8ade10c068af6ec8ab271fa4869ba1ee5b8d179b03ac
|
data/README.md
CHANGED
@@ -1,57 +1,57 @@
|
|
1
|
-
# BitsInBytes
|
2
|
-
|
3
|
-
'BitsInBytes' is a ruby gem which allows the user to determine what bits are set
|
4
|
-
in a byte in an object oriented way.
|
5
|
-
|
6
|
-
## Installation
|
7
|
-
|
8
|
-
Add this line to your application's Gemfile:
|
9
|
-
|
10
|
-
```ruby
|
11
|
-
gem 'bits_in_bytes'
|
12
|
-
```
|
13
|
-
|
14
|
-
And then execute:
|
15
|
-
|
16
|
-
$ bundle
|
17
|
-
|
18
|
-
Or install it yourself as:
|
19
|
-
|
20
|
-
$ gem install bits_in_bytes
|
21
|
-
|
22
|
-
## Usage
|
23
|
-
|
24
|
-
You can use the 'BitInByte' object to find out which bits are set in a given
|
25
|
-
byte. The first argument is the position of the bit you would like to check.
|
26
|
-
The position must be in the range of 1 to 8.
|
27
|
-
The second argument is the actual byte value, which must be in the
|
28
|
-
range of 0 to 255. It may be a decimal, hex, octal or binary value.
|
29
|
-
|
30
|
-
Simple examples:
|
31
|
-
```ruby
|
32
|
-
BitInByte.new(8, 128).value # output -> true
|
33
|
-
BitInByte.new(4,
|
34
|
-
BitInByte.new(1, 17).value # output -> true
|
35
|
-
BitInByte.new(3, 64).value # output -> false
|
36
|
-
BitInByte.new(5, 0x10).value # output -> true
|
37
|
-
BitInByte.new(7, 0b00000011).value # output -> false
|
38
|
-
BitInByte.new(2, 0o12).value # output -> true
|
39
|
-
```
|
40
|
-
|
41
|
-
## Development
|
42
|
-
|
43
|
-
After checking out the repo, run `bin/setup` to install dependencies.
|
44
|
-
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
45
|
-
|
46
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
47
|
-
To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`,
|
48
|
-
which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
49
|
-
|
50
|
-
## Contributing
|
51
|
-
|
52
|
-
Bug reports and pull requests are welcome and highly appreciated on GitHub at https://github.com/SNException/bits_in_bytes.
|
53
|
-
|
54
|
-
## License
|
55
|
-
|
56
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
57
|
-
See LICENSE.txt for more information.
|
1
|
+
# BitsInBytes
|
2
|
+
|
3
|
+
'BitsInBytes' is a ruby gem which allows the user to determine what bits are set
|
4
|
+
in a byte in an object oriented way.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'bits_in_bytes'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install bits_in_bytes
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
You can use the 'BitInByte' object to find out which bits are set in a given
|
25
|
+
byte. The first argument is the position of the bit you would like to check.
|
26
|
+
The position must be in the range of 1 to 8.
|
27
|
+
The second argument is the actual byte value, which must be in the
|
28
|
+
range of 0 to 255. It may be a decimal, hex, octal or binary value.
|
29
|
+
|
30
|
+
Simple examples:
|
31
|
+
```ruby
|
32
|
+
BitInByte.new(8, 128).value # output -> true
|
33
|
+
BitInByte.new(4, 4).value # output -> false
|
34
|
+
BitInByte.new(1, 17).value # output -> true
|
35
|
+
BitInByte.new(3, 64).value # output -> false
|
36
|
+
BitInByte.new(5, 0x10).value # output -> true
|
37
|
+
BitInByte.new(7, 0b00000011).value # output -> false
|
38
|
+
BitInByte.new(2, 0o12).value # output -> true
|
39
|
+
```
|
40
|
+
|
41
|
+
## Development
|
42
|
+
|
43
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
44
|
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
45
|
+
|
46
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
47
|
+
To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`,
|
48
|
+
which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
49
|
+
|
50
|
+
## Contributing
|
51
|
+
|
52
|
+
Bug reports and pull requests are welcome and highly appreciated on GitHub at https://github.com/SNException/bits_in_bytes.
|
53
|
+
|
54
|
+
## License
|
55
|
+
|
56
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
57
|
+
See LICENSE.txt for more information.
|
data/lib/core/version.rb
CHANGED