attr_extras 0.0.1 → 0.0.2

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 CHANGED
@@ -1,13 +1,19 @@
1
1
  # attr\_extras
2
2
 
3
- Takes some of the boilerplate out of some common Ruby patterns and complements `attr` (`attr_accessor`), `attr_reader` and `attr_writer` nicely.
3
+ Takes the boilerplate out of some common Ruby patterns and complements `attr` (`attr_accessor`), `attr_reader` and `attr_writer` nicely.
4
4
 
5
- Lets you do:
5
+ Provides:
6
+
7
+ * `attr_init :foo, :bar` to define an initializer that takes two arguments and assigns `@foo` and `@bar`.
8
+ * `attr_private :foo, :bar` to define private readers for `@foo` and `@bar`.
9
+
10
+
11
+ ## Example
6
12
 
7
13
  ``` ruby
8
14
  class MyClass
9
15
  attr_init :foo, :bar
10
- attr_reader_private :foo
16
+ attr_private :foo
11
17
 
12
18
  def oof
13
19
  foo.reverse # Uses the private method.
@@ -18,6 +24,7 @@ x = MyClass.new("Foo!", "Bar!")
18
24
  x.oof # => "!ooF"
19
25
  ```
20
26
 
27
+
21
28
  ## Installation
22
29
 
23
30
  Add this line to your application's `Gemfile`:
@@ -32,4 +39,28 @@ Or install it yourself as:
32
39
 
33
40
  gem install attr_extras
34
41
 
42
+
35
43
  ## License
44
+
45
+ Copyright (c) 2012 Barsoom AB
46
+
47
+ MIT License
48
+
49
+ Permission is hereby granted, free of charge, to any person obtaining
50
+ a copy of this software and associated documentation files (the
51
+ "Software"), to deal in the Software without restriction, including
52
+ without limitation the rights to use, copy, modify, merge, publish,
53
+ distribute, sublicense, and/or sell copies of the Software, and to
54
+ permit persons to whom the Software is furnished to do so, subject to
55
+ the following conditions:
56
+
57
+ The above copyright notice and this permission notice shall be
58
+ included in all copies or substantial portions of the Software.
59
+
60
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
61
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
62
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
63
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
64
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
65
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
66
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,3 +1,3 @@
1
1
  module AttrExtras
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/attr_extras.rb CHANGED
@@ -14,7 +14,7 @@ module AttrExtras
14
14
  end
15
15
  end
16
16
 
17
- def attr_reader_private(*keys)
17
+ def attr_private(*keys)
18
18
  attr_reader *keys
19
19
  private *keys
20
20
  end
@@ -3,7 +3,7 @@ require "attr_extras"
3
3
 
4
4
  class Example
5
5
  attr_init :foo, :bar
6
- attr_reader_private :foo, :bar
6
+ attr_private :foo, :bar
7
7
  end
8
8
 
9
9
  describe Object, ".attr_init" do
@@ -18,7 +18,7 @@ describe Object, ".attr_init" do
18
18
  end
19
19
  end
20
20
 
21
- describe Object, ".attr_reader_private" do
21
+ describe Object, ".attr_private" do
22
22
  it "creates private readers" do
23
23
  example = Example.new("Foo", "Bar")
24
24
  example.send(:foo).must_equal "Foo"
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.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: