attr_extras 0.0.3 → 0.0.4

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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Takes some boilerplate out of Ruby and complements `attr_accessor`, `attr_reader` and `attr_writer` nicely by providing:
4
4
 
5
- `attr_init :foo, :bar`<br>
5
+ `attr_initialize :foo, :bar`<br>
6
6
  Defines an initializer that takes two arguments and assigns `@foo` and `@bar`.
7
7
 
8
8
  `attr_private :foo, :bar`<br>
@@ -13,7 +13,7 @@ Defines private readers for `@foo` and `@bar`.
13
13
 
14
14
  ``` ruby
15
15
  class MyClass
16
- attr_init :foo, :bar
16
+ attr_initialize :foo, :bar
17
17
  attr_private :foo
18
18
 
19
19
  def oof
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 attr_private methods.}
7
+ gem.summary = %q{Adds attr_initialize 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.rb CHANGED
@@ -2,21 +2,21 @@ require "attr_extras/version"
2
2
 
3
3
  module AttrExtras
4
4
  module ClassMethods
5
- def attr_init(*keys)
5
+ def attr_initialize(*names)
6
6
  define_method(:initialize) do |*values|
7
- unless values.length == keys.length
8
- raise ArgumentError, "wrong number of arguments (#{values.length} for #{keys.length})"
7
+ unless values.length == names.length
8
+ raise ArgumentError, "wrong number of arguments (#{values.length} for #{names.length})"
9
9
  end
10
10
 
11
- keys.zip(values).each do |k, v|
12
- instance_variable_set("@#{k}", v)
11
+ names.zip(values).each do |name, value|
12
+ instance_variable_set("@#{name}", value)
13
13
  end
14
14
  end
15
15
  end
16
16
 
17
- def attr_private(*keys)
18
- attr_reader *keys
19
- private *keys
17
+ def attr_private(*names)
18
+ attr_reader *names
19
+ private *names
20
20
  end
21
21
  end
22
22
  end
@@ -1,3 +1,3 @@
1
1
  module AttrExtras
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -2,7 +2,7 @@ require "minitest/autorun"
2
2
  require "attr_extras"
3
3
 
4
4
  class Example
5
- attr_init :foo, :bar
5
+ attr_initialize :foo, :bar
6
6
  attr_private :foo, :bar
7
7
  end
8
8
 
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.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-16 00:00:00.000000000 Z
12
+ date: 2012-10-17 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email:
@@ -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 attr_private methods.
52
+ summary: Adds attr_initialize and attr_private methods.
53
53
  test_files:
54
54
  - spec/attr_extras_spec.rb
55
55
  has_rdoc: