attr_bool 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 +4 -4
- data/README.md +9 -7
- data/attr_bool.gemspec +2 -2
- data/lib/attr_bool/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8c2838e4127813ba45ee36511d2ab27acbf336a7023dcfa88035b71164d9b01
|
4
|
+
data.tar.gz: 2d0af46054521a4fa83ae3d0aea20fd84bdb6da19b9a151087a81af34d2706f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60d3d316e83c791256b8125742ef6e741452cf7a5de29b6162417629b1377f5358704b7fc7dfc1985fed20450e31d00a2797bddb81216110794691989080d2a6
|
7
|
+
data.tar.gz: 2ece3c6ecd679140f9f67c5087e653e960e74aa9651f3c98368cfb66a36a096ff2513c863f988e2f87d55e211c277f9682c591b95188909e4e4f858034b76423
|
data/README.md
CHANGED
@@ -40,15 +40,14 @@ Features:
|
|
40
40
|
- Can use multiple symbols and/or strings.
|
41
41
|
- Can force bool values.
|
42
42
|
- Can define custom logic with a block/proc.
|
43
|
-
-
|
43
|
+
- Can do DSL chaining, just like the core `attr` methods that return an array of the new method names.
|
44
44
|
- Can use refinements (`using AttrBool::Ref`) instead of `extend`.
|
45
|
-
- This allows you to refine the top module only of your project, instead of having to extend every class.
|
46
45
|
- Fails fast if an instance variable name is invalid (if you don't use a block/proc).
|
47
46
|
|
48
47
|
Anti-features:
|
49
48
|
- No default values.
|
50
49
|
- Initialize your instance variables in `def initialize` like normal.
|
51
|
-
- Using default values has performance issues and other drawbacks, so better to just match the core `attr` methods.
|
50
|
+
- Using default values has performance/memory issues and other drawbacks, so better to just match the core `attr` methods.
|
52
51
|
- Uses inner `AttrBool::Ext` & `AttrBool::Ref` instead of `AttrBool`.
|
53
52
|
- Some gems use the `extend AttrBool` (top module) pattern, but this includes `VERSION` in all of your classes/modules.
|
54
53
|
- Doesn't monkey-patch the core class/module by default.
|
@@ -158,20 +157,23 @@ class TheTodd
|
|
158
157
|
end
|
159
158
|
```
|
160
159
|
|
161
|
-
If you don't want to have to add `extend AttrBool::Ext` to every class/module, you can simply refine the
|
160
|
+
If you don't want to have to add `extend AttrBool::Ext` to every inner class/module (within the same file), then you can simply refine the outer module or the file:
|
162
161
|
|
163
162
|
```ruby
|
164
163
|
require 'attr_bool'
|
165
164
|
|
165
|
+
#using AttrBool::Ref # Can refine the entire file instead (doesn't affect other files).
|
166
|
+
|
166
167
|
module TheToddMod
|
167
168
|
using AttrBool::Ref
|
168
|
-
end
|
169
169
|
|
170
|
-
# --- Some other file.
|
171
|
-
module TheToddMod
|
172
170
|
class TheTodd
|
173
171
|
attr_bool :banana_hammock
|
174
172
|
end
|
173
|
+
|
174
|
+
class TheToddBod
|
175
|
+
attr_bool :bounce_pecs
|
176
|
+
end
|
175
177
|
end
|
176
178
|
```
|
177
179
|
|
data/attr_bool.gemspec
CHANGED
@@ -14,8 +14,8 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.description = <<~DESC
|
15
15
|
#{spec.summary}
|
16
16
|
|
17
|
-
|
18
|
-
(1) in your
|
17
|
+
To get started, pick one:
|
18
|
+
(1) in your class/module, add `using AttrBool::Ref`,
|
19
19
|
or (2) in your class/module, add `extend AttrBool::Ext`,
|
20
20
|
or (3) in your app/script (not library), include `require 'attr_bool/core_ext'`.
|
21
21
|
|
data/lib/attr_bool/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attr_bool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bradley Whited
|
@@ -12,8 +12,8 @@ dependencies: []
|
|
12
12
|
description: |
|
13
13
|
Finally attr_accessor? & attr_reader? with question marks for booleans/predicates!?
|
14
14
|
|
15
|
-
|
16
|
-
(1) in your
|
15
|
+
To get started, pick one:
|
16
|
+
(1) in your class/module, add `using AttrBool::Ref`,
|
17
17
|
or (2) in your class/module, add `extend AttrBool::Ext`,
|
18
18
|
or (3) in your app/script (not library), include `require 'attr_bool/core_ext'`.
|
19
19
|
|
@@ -62,7 +62,7 @@ rdoc_options:
|
|
62
62
|
- "--markup"
|
63
63
|
- markdown
|
64
64
|
- "--title"
|
65
|
-
- AttrBool v0.3.
|
65
|
+
- AttrBool v0.3.1
|
66
66
|
- "--main"
|
67
67
|
- README.md
|
68
68
|
require_paths:
|