private_attr 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -2
- data/lib/private_attr/everywhere.rb +4 -0
- data/lib/private_attr/version.rb +1 -1
- data/spec/private_attr/everywhere_spec.rb +20 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27d70be6b534e13580f32b23578026edd0fe18d7
|
4
|
+
data.tar.gz: 97450509eea0c0fc7eff3141bf71aeea616d0a00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7d251ce70f4ad47d4ee771eba16fd643b9ac64e6aa7d0378aac4eace96a0f4434ae2a829f3e2db05343aa86cb4c5f90074ded4cc8b203f9f18f446c83416004
|
7
|
+
data.tar.gz: 89f9dc9ce97d0b5d0205857fd3ec5203c27a56e2b3bbe7c90410d06c6a54b388c337aa09ca7922b3a1508637982552c5359a468714c91540689a046506423f59
|
data/README.md
CHANGED
@@ -17,8 +17,9 @@ class Foo
|
|
17
17
|
end
|
18
18
|
```
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
Unfortunately, this makes Ruby show a ‘private attribute?’ warning.
|
21
|
+
Also, I really like to declare my attribute readers and writers near
|
22
|
+
the top of my classes, which means I sometimes use something like:
|
22
23
|
|
23
24
|
```ruby
|
24
25
|
class Bar
|
@@ -79,6 +80,10 @@ class Bar
|
|
79
80
|
end
|
80
81
|
```
|
81
82
|
|
83
|
+
If you don’t want to extend all of your modules and classes
|
84
|
+
separately you can also `require 'private_attr/everywhere'`
|
85
|
+
and the methods will be available everywhere.
|
86
|
+
|
82
87
|
## Contributing
|
83
88
|
|
84
89
|
1. Fork it
|
data/lib/private_attr/version.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
|
3
|
+
describe 'private_attr/everywhere' do
|
4
|
+
# these particular tests must be ran in order
|
5
|
+
def self.test_order
|
6
|
+
:alpha
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'requiring only private_attr keeps Classes and Modules intact' do
|
10
|
+
require 'private_attr'
|
11
|
+
Class.new.private_methods.wont_include :private_attr_reader
|
12
|
+
Module.new.private_methods.wont_include :private_attr_reader
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'requiring private_attr/everywhere adds it to all Classes and Modules' do
|
16
|
+
require 'private_attr/everywhere'
|
17
|
+
Class.new.private_methods.must_include :private_attr_reader
|
18
|
+
Module.new.private_methods.must_include :private_attr_reader
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: private_attr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacob Swanner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -52,8 +52,10 @@ files:
|
|
52
52
|
- README.md
|
53
53
|
- Rakefile
|
54
54
|
- lib/private_attr.rb
|
55
|
+
- lib/private_attr/everywhere.rb
|
55
56
|
- lib/private_attr/version.rb
|
56
57
|
- private_attr.gemspec
|
58
|
+
- spec/private_attr/everywhere_spec.rb
|
57
59
|
- spec/private_attr_spec.rb
|
58
60
|
homepage: https://github.com/jswanner/private_attr
|
59
61
|
licenses:
|
@@ -75,10 +77,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
77
|
version: '0'
|
76
78
|
requirements: []
|
77
79
|
rubyforge_project:
|
78
|
-
rubygems_version: 2.
|
80
|
+
rubygems_version: 2.4.5
|
79
81
|
signing_key:
|
80
82
|
specification_version: 4
|
81
83
|
summary: Easily create private/protected attribute readers/writers
|
82
84
|
test_files:
|
85
|
+
- spec/private_attr/everywhere_spec.rb
|
83
86
|
- spec/private_attr_spec.rb
|
84
|
-
has_rdoc:
|