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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3fe27ad01f2e233e9d5422b483cfeef78abe6ac5
4
- data.tar.gz: 09790254ddce8d6828c3a73cff4446edb3de33c6
3
+ metadata.gz: 27d70be6b534e13580f32b23578026edd0fe18d7
4
+ data.tar.gz: 97450509eea0c0fc7eff3141bf71aeea616d0a00
5
5
  SHA512:
6
- metadata.gz: 6921dcd2d484d73587154668ea5e99ac1c3e5586d1600c487d02388b1e9348342a0794cc20305e5e307c9f2cb70c717123a7c767d8a3be531c1f4390a61d0d24
7
- data.tar.gz: 5ccea01bdb065d1dda91d50568f1b2df5d088b20974774ab84c39a5f41e0903bb06baf0fb1de3dc2427e3f11e83524a086d1787b60e8a639b6a452f509801a23
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
- But, I really like to declare my attribute readers and writers near the
21
- top of my classes, which means I sometimes use something like:
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
@@ -0,0 +1,4 @@
1
+ require_relative '../private_attr'
2
+
3
+ # Module.include is private in Ruby < 2.1
4
+ Module.__send__ :include, PrivateAttr
@@ -1,3 +1,3 @@
1
1
  module PrivateAttr
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -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.0.0
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-03 00:00:00.000000000 Z
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.2.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: