attr_extras 0.0.2 → 0.0.3
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.
- data/README.md +9 -7
- data/attr_extras.gemspec +1 -1
- data/lib/attr_extras/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
# attr\_extras
|
2
2
|
|
3
|
-
Takes
|
3
|
+
Takes some boilerplate out of Ruby and complements `attr_accessor`, `attr_reader` and `attr_writer` nicely by providing:
|
4
4
|
|
5
|
-
|
5
|
+
`attr_init :foo, :bar`<br>
|
6
|
+
Defines an initializer that takes two arguments and assigns `@foo` and `@bar`.
|
6
7
|
|
7
|
-
|
8
|
-
|
8
|
+
`attr_private :foo, :bar`<br>
|
9
|
+
Defines private readers for `@foo` and `@bar`.
|
9
10
|
|
10
11
|
|
11
12
|
## Example
|
@@ -16,12 +17,13 @@ class MyClass
|
|
16
17
|
attr_private :foo
|
17
18
|
|
18
19
|
def oof
|
19
|
-
foo.reverse
|
20
|
+
foo.reverse
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
23
24
|
x = MyClass.new("Foo!", "Bar!")
|
24
25
|
x.oof # => "!ooF"
|
26
|
+
x.foo # NoMethodError: private method `foo' called.
|
25
27
|
```
|
26
28
|
|
27
29
|
|
@@ -29,7 +31,7 @@ x.oof # => "!ooF"
|
|
29
31
|
|
30
32
|
Add this line to your application's `Gemfile`:
|
31
33
|
|
32
|
-
gem
|
34
|
+
gem "attr_extras"
|
33
35
|
|
34
36
|
And then execute:
|
35
37
|
|
@@ -42,7 +44,7 @@ Or install it yourself as:
|
|
42
44
|
|
43
45
|
## License
|
44
46
|
|
45
|
-
Copyright (c) 2012 Barsoom AB
|
47
|
+
Copyright (c) 2012 [Barsoom AB](http://barsoom.se)
|
46
48
|
|
47
49
|
MIT License
|
48
50
|
|
data/attr_extras.gemspec
CHANGED
@@ -4,7 +4,7 @@ require File.expand_path('../lib/attr_extras/version', __FILE__)
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.authors = ["Henrik Nyh"]
|
6
6
|
gem.email = ["henrik@nyh.se"]
|
7
|
-
gem.summary = %q{Adds attr_init and
|
7
|
+
gem.summary = %q{Adds attr_init and attr_private methods.}
|
8
8
|
gem.homepage = "https://github.com/barsoom/attr_extras"
|
9
9
|
|
10
10
|
gem.files = `git ls-files`.split($\)
|
data/lib/attr_extras/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attr_extras
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -49,7 +49,7 @@ rubyforge_project:
|
|
49
49
|
rubygems_version: 1.8.5
|
50
50
|
signing_key:
|
51
51
|
specification_version: 3
|
52
|
-
summary: Adds attr_init and
|
52
|
+
summary: Adds attr_init and attr_private methods.
|
53
53
|
test_files:
|
54
54
|
- spec/attr_extras_spec.rb
|
55
55
|
has_rdoc:
|