banditmask 0.3.0 → 0.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c07c68905cfe2a56b3ba19fa9192604e505fe06e
4
- data.tar.gz: 5787ac69e4472405d2e0408203e788128eaabb19
3
+ metadata.gz: 2bc728e7282f48a7f2b68abe40960893619622ab
4
+ data.tar.gz: e364832686de46d7229a5b72a39a786338f0dc1d
5
5
  SHA512:
6
- metadata.gz: 5535575ab548f020d6043df8927ba7da1fe90bf094c76894890894f1c9c153dabf6fab2501ed23be227c169a8d53af94c41b579a6631777b0c30611876a51c9e
7
- data.tar.gz: b0a80aa7a44e9e02d32465d9bc4c200d697bb5fdefe63239328faad9255e3b387d06fbf5fe44717017ae239be4ec500915b23fc9a70ac3bc3cb8b5eb10e3b3a9
6
+ metadata.gz: 8eb4c9763f19f7ffbc936a2f49ab59569bd04277c9d54b151a1f51c4a5cad1bfb5cc865fad8e2b51a89acc24487f51a57f83f2825af8838da697ecc6ee690bb4
7
+ data.tar.gz: 06260ac70e9fc1ce9d4a2fab8951adda40443d044a7a4e898cc669915522eafc52e702d73d0b85e7dc70647e30d5e00c0c2995a79e2536b3d291becbddf8caae
data/README.md CHANGED
@@ -1,134 +1,3 @@
1
- # [![Gem Version](https://badge.fury.io/rb/banditmask.svg)](http://badge.fury.io/rb/banditmask) [![Build Status](https://travis-ci.org/jparker/banditmask.svg?branch=master)](https://travis-ci.org/jparker/banditmask)
2
-
3
1
  # BanditMask
4
2
 
5
- BanditMask provides a generic wrapper for working with bitmasks.
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'banditmask'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install banditmask
22
-
23
- ## Usage
24
-
25
- ### BanditMask
26
-
27
- Create a class which inherits from BanditMask, and declare the available bit
28
- names and their corresponding values.
29
-
30
- ```ruby
31
- class ChmodMask < BanditMask
32
- bit :read, 0b001
33
- bit :write, 0b010
34
- bit :execute, 0b100
35
- end
36
-
37
- ChmodMask.bits # => { :read => 1, :write => 2, :execute => 4 }
38
- ```
39
-
40
- Instantiate a new mask class:
41
-
42
- ```ruby
43
- mask = ChmodMask.new
44
- # or
45
- current_bitmask = 0b001 | 0b010
46
- mask = ChmodMask.new current_bitmask
47
- ```
48
-
49
- Enable bits by name.
50
-
51
- ```ruby
52
- mask << :read << :execute
53
- ```
54
-
55
- Ask whether specific bits are enabled.
56
-
57
- ```ruby
58
- mask.include? :read # => true
59
- mask.include? :write # => false
60
- mask.include? :execute # => true
61
- mask.include? :read, :write # => false
62
- mask.include? :read, :execute # => true
63
- ```
64
-
65
- Retrieve a list of all currently enabled bits.
66
-
67
- ```ruby
68
- mask.bits # => [:read, :execute]
69
- ```
70
-
71
- ### BanditMask::Banditry
72
-
73
- In a class with a bitmask attribute, extend BanditMask::Banditry and call
74
- BanditMask::Banditry.bandit_mask to add accessor methods for working with the
75
- bitmask attribute.
76
-
77
- ```ruby
78
- class ObjectWithBitmaskAttribute
79
- attr_accessor :bitmask
80
-
81
- extend BanditMask::Banditry
82
- bandit_mask :bitmask, as: :bits, with: ChmodMask
83
- end
84
-
85
- obj = ObjectWithBitmaskAttribute.new
86
- obj.bitmask = 0b001
87
- ```
88
-
89
- This gives you a reader method which returns the BanditMask representation
90
- of the bitmask attribute.
91
-
92
- ```ruby
93
- obj.bits # => #<ChmodMask:0x007f941b9518c8 @bitmask=1>
94
- ```
95
-
96
- It also gives you a writer method which lets you modify the bitmask. The
97
- writer accepts BanditMask objects or an Array of bits.
98
-
99
- ```ruby
100
- obj.bits |= :write
101
- obj.bitmask # => 3
102
- obj.bits = [:read, :execute]
103
- obj.bitmask # => 5
104
- ```
105
-
106
- Finally, it gives you a query method for checking whether particular bits are
107
- set on the bitmask.
108
-
109
- ```ruby
110
- obj.bits? :read # => true
111
- obj.bits? :write # => false
112
- obj.bits? :execute # => true
113
- obj.bits? :read, :write # => false
114
- obj.bits? :read, :execute # => true
115
- ```
116
-
117
- ## Development
118
-
119
- After checking out the repo, run `bin/setup` to install dependencies. Then, run
120
- `bin/console` for an interactive prompt that will allow you to experiment.
121
-
122
- To install this gem onto your local machine, run `bundle exec rake install`. To
123
- release a new version, update the version number in `version.rb`, and then run
124
- `bundle exec rake release` to create a git tag for the version, push git
125
- commits and tags, and push the `.gem` file to
126
- [rubygems.org](https://rubygems.org).
127
-
128
- ## Contributing
129
-
130
- 1. Fork it ( https://github.com/[my-github-username]/banditmask/fork )
131
- 2. Create your feature branch (`git checkout -b my-new-feature`)
132
- 3. Commit your changes (`git commit -am 'Add some feature'`)
133
- 4. Push to the branch (`git push origin my-new-feature`)
134
- 5. Create a new Pull Request
3
+ Moved to [banditry](https://github.com/jparker/banditry).
data/banditmask.gemspec CHANGED
@@ -26,4 +26,11 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency 'minitest', '~> 5.7'
27
27
 
28
28
  spec.add_development_dependency 'pry'
29
+
30
+ spec.post_install_message = <<-END
31
+ ! The 'banditmask' gem has been deprecated and has been replaced by 'banditry'.
32
+ !
33
+ ! See: https://rubygems.org/gems/banditry
34
+ ! And: https://github.com/jparker/banditry
35
+ END
29
36
  end
data/lib/banditmask.rb CHANGED
@@ -1,3 +1,6 @@
1
+ warn '[DEPRECATION] This gem has been renamed to banditry and will no ' \
2
+ 'longer be supported. Please switch to banditry as soon as possible.'
3
+
1
4
  require 'banditmask/version'
2
5
  require 'banditmask/banditry'
3
6
 
@@ -1,3 +1,3 @@
1
1
  class BanditMask
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: banditmask
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Parker
@@ -89,7 +89,11 @@ homepage: https://github.com/jparker/banditmask
89
89
  licenses:
90
90
  - MIT
91
91
  metadata: {}
92
- post_install_message:
92
+ post_install_message: |
93
+ ! The 'banditmask' gem has been deprecated and has been replaced by 'banditry'.
94
+ !
95
+ ! See: https://rubygems.org/gems/banditry
96
+ ! And: https://github.com/jparker/banditry
93
97
  rdoc_options: []
94
98
  require_paths:
95
99
  - lib