private_attr 0.1.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +3 -0
- data/Gemfile +0 -3
- data/Rakefile +1 -0
- data/lib/private_attr.rb +14 -12
- data/lib/private_attr/version.rb +1 -1
- data/private_attr.gemspec +3 -0
- data/spec/private_attr_spec.rb +6 -0
- metadata +39 -12
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3fe27ad01f2e233e9d5422b483cfeef78abe6ac5
|
4
|
+
data.tar.gz: 09790254ddce8d6828c3a73cff4446edb3de33c6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6921dcd2d484d73587154668ea5e99ac1c3e5586d1600c487d02388b1e9348342a0794cc20305e5e307c9f2cb70c717123a7c767d8a3be531c1f4390a61d0d24
|
7
|
+
data.tar.gz: 5ccea01bdb065d1dda91d50568f1b2df5d088b20974774ab84c39a5f41e0903bb06baf0fb1de3dc2427e3f11e83524a086d1787b60e8a639b6a452f509801a23
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/lib/private_attr.rb
CHANGED
@@ -1,33 +1,35 @@
|
|
1
1
|
require "private_attr/version"
|
2
2
|
|
3
3
|
module PrivateAttr
|
4
|
+
module_function
|
5
|
+
|
4
6
|
def private_attr_accessor *attr
|
5
|
-
private_attr_reader
|
6
|
-
private_attr_writer
|
7
|
+
private_attr_reader(*attr)
|
8
|
+
private_attr_writer(*attr)
|
7
9
|
end
|
8
10
|
|
9
11
|
def private_attr_reader *attr
|
10
|
-
attr_reader
|
11
|
-
private
|
12
|
+
attr_reader(*attr)
|
13
|
+
private(*attr)
|
12
14
|
end
|
13
15
|
|
14
16
|
def private_attr_writer *attr
|
15
|
-
attr_writer
|
16
|
-
private
|
17
|
+
attr_writer(*attr)
|
18
|
+
private(*attr.map { |a| "#{a}=" })
|
17
19
|
end
|
18
20
|
|
19
21
|
def protected_attr_accessor *attr
|
20
|
-
protected_attr_reader
|
21
|
-
protected_attr_writer
|
22
|
+
protected_attr_reader(*attr)
|
23
|
+
protected_attr_writer(*attr)
|
22
24
|
end
|
23
25
|
|
24
26
|
def protected_attr_reader *attr
|
25
|
-
attr_reader
|
26
|
-
protected
|
27
|
+
attr_reader(*attr)
|
28
|
+
protected(*attr)
|
27
29
|
end
|
28
30
|
|
29
31
|
def protected_attr_writer *attr
|
30
|
-
attr_writer
|
31
|
-
protected
|
32
|
+
attr_writer(*attr)
|
33
|
+
protected(*attr.map { |a| "#{a}=" })
|
32
34
|
end
|
33
35
|
end
|
data/lib/private_attr/version.rb
CHANGED
data/private_attr.gemspec
CHANGED
@@ -17,4 +17,7 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ["lib"]
|
20
|
+
|
21
|
+
gem.add_development_dependency 'minitest', '~> 5.0'
|
22
|
+
gem.add_development_dependency 'rake', '~> 10.0'
|
20
23
|
end
|
data/spec/private_attr_spec.rb
CHANGED
@@ -242,4 +242,10 @@ describe PrivateAttr do
|
|
242
242
|
other.instance_variable_get('@writer').must_equal value
|
243
243
|
end
|
244
244
|
end
|
245
|
+
|
246
|
+
describe 'method visibility' do
|
247
|
+
it 'extending classes does not increase their public APIs' do
|
248
|
+
PrivateDummy.public_methods.wont_include :private_attr_accessor
|
249
|
+
end
|
250
|
+
end
|
245
251
|
end
|
metadata
CHANGED
@@ -1,16 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: private_attr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jacob Swanner
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
11
|
+
date: 2015-02-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: minitest
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
14
41
|
description: Easily create private/protected attribute readers/writers
|
15
42
|
email:
|
16
43
|
- jacob@jacobswanner.com
|
@@ -18,8 +45,8 @@ executables: []
|
|
18
45
|
extensions: []
|
19
46
|
extra_rdoc_files: []
|
20
47
|
files:
|
21
|
-
- .gitignore
|
22
|
-
- .travis.yml
|
48
|
+
- ".gitignore"
|
49
|
+
- ".travis.yml"
|
23
50
|
- Gemfile
|
24
51
|
- LICENSE.txt
|
25
52
|
- README.md
|
@@ -31,27 +58,27 @@ files:
|
|
31
58
|
homepage: https://github.com/jswanner/private_attr
|
32
59
|
licenses:
|
33
60
|
- MIT
|
61
|
+
metadata: {}
|
34
62
|
post_install_message:
|
35
63
|
rdoc_options: []
|
36
64
|
require_paths:
|
37
65
|
- lib
|
38
66
|
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
67
|
requirements:
|
41
|
-
- -
|
68
|
+
- - ">="
|
42
69
|
- !ruby/object:Gem::Version
|
43
70
|
version: '0'
|
44
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
-
none: false
|
46
72
|
requirements:
|
47
|
-
- -
|
73
|
+
- - ">="
|
48
74
|
- !ruby/object:Gem::Version
|
49
75
|
version: '0'
|
50
76
|
requirements: []
|
51
77
|
rubyforge_project:
|
52
|
-
rubygems_version:
|
78
|
+
rubygems_version: 2.2.2
|
53
79
|
signing_key:
|
54
|
-
specification_version:
|
80
|
+
specification_version: 4
|
55
81
|
summary: Easily create private/protected attribute readers/writers
|
56
82
|
test_files:
|
57
83
|
- spec/private_attr_spec.rb
|
84
|
+
has_rdoc:
|