shuber-hattr_accessor 1.0.1 → 1.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/CHANGELOG +7 -1
- data/{README → README.markdown} +8 -10
- data/Rakefile +2 -2
- data/init.rb +1 -2
- data/lib/alias_method_chain.rb +1 -3
- data/lib/hattr_accessor.rb +1 -0
- metadata +3 -3
data/CHANGELOG
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
2009-01-08 - Sean Huber (shuber@huberry.com)
|
|
2
|
+
* Update CHANGELOG email addresses
|
|
3
|
+
* Remove .gitignore
|
|
4
|
+
* Update README
|
|
5
|
+
* Move include logic into the main hattr_accessor file
|
|
6
|
+
|
|
7
|
+
2008-10-17 - Sean Huber (shuber@huberry.com)
|
|
2
8
|
* Refactor #{attribute}_with_hattr_accessor method
|
|
3
9
|
* Rename doc/README.markdown to doc/README
|
|
4
10
|
|
data/{README → README.markdown}
RENAMED
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
hattr\_accessor
|
|
2
|
+
===============
|
|
3
3
|
|
|
4
|
-
A gem/plugin that allows you to define
|
|
4
|
+
A gem/plugin that allows you to define attr\_accessors that reference members of a hash.
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Installation
|
|
8
8
|
------------
|
|
9
9
|
|
|
10
|
+
gem install shuber-hattr_accessor --source http://gems.github.com
|
|
11
|
+
OR
|
|
10
12
|
script/plugin install git://github.com/shuber/proxy.git
|
|
11
13
|
|
|
12
|
-
OR
|
|
13
|
-
|
|
14
|
-
gem install shuber-hattr_accessor
|
|
15
|
-
|
|
16
14
|
|
|
17
15
|
Usage
|
|
18
16
|
-----
|
|
19
17
|
|
|
20
|
-
The
|
|
18
|
+
The hattr\_accessor method requires an option named `:attribute` which should be a symbol that represents the attribute name of the hash that you want to reference. For example:
|
|
21
19
|
|
|
22
20
|
class SomeClass
|
|
23
21
|
attr_accessor :my_hash
|
|
@@ -28,7 +26,7 @@ The hattr_accessor method requires an option named :attribute which should be a
|
|
|
28
26
|
@some_class.my_attr = 'test'
|
|
29
27
|
@some_class.my_hash # => { :my_attr => 'test' }
|
|
30
28
|
|
|
31
|
-
You may optionally pass a
|
|
29
|
+
You may optionally pass a `:type` option which will type cast the value when calling the getter method. For example:
|
|
32
30
|
|
|
33
31
|
class SomeClass
|
|
34
32
|
attr_accessor :my_hash
|
|
@@ -52,7 +50,7 @@ This is useful if you're using this gem/plugin with ActiveRecord which will pass
|
|
|
52
50
|
end
|
|
53
51
|
end
|
|
54
52
|
|
|
55
|
-
The current options (email me for suggestions for others) for
|
|
53
|
+
The current options (email me for suggestions for others) for `:type` are:
|
|
56
54
|
|
|
57
55
|
:string
|
|
58
56
|
:integer
|
data/Rakefile
CHANGED
|
@@ -5,14 +5,14 @@ require 'rake/rdoctask'
|
|
|
5
5
|
desc 'Default: run the hattr_accessor tests'
|
|
6
6
|
task :default => :test
|
|
7
7
|
|
|
8
|
-
desc 'Test the hattr_accessor plugin.'
|
|
8
|
+
desc 'Test the hattr_accessor gem/plugin.'
|
|
9
9
|
Rake::TestTask.new(:test) do |t|
|
|
10
10
|
t.libs << 'lib'
|
|
11
11
|
t.pattern = 'test/*_test.rb'
|
|
12
12
|
t.verbose = true
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
desc 'Generate documentation for the hattr_accessor plugin.'
|
|
15
|
+
desc 'Generate documentation for the hattr_accessor gem/plugin.'
|
|
16
16
|
Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
17
17
|
rdoc.rdoc_dir = 'rdoc'
|
|
18
18
|
rdoc.title = 'hattr_accessor'
|
data/init.rb
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
require
|
|
2
|
-
$:.unshift File.dirname(__FILE__) + '/lib'
|
|
1
|
+
require 'hattr_accessor'
|
data/lib/alias_method_chain.rb
CHANGED
data/lib/hattr_accessor.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shuber-hattr_accessor
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sean Huber
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date:
|
|
12
|
+
date: 2009-01-08 00:00:00 -08:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies: []
|
|
15
15
|
|
|
@@ -28,7 +28,7 @@ files:
|
|
|
28
28
|
- lib/hattr_accessor.rb
|
|
29
29
|
- MIT-LICENSE
|
|
30
30
|
- Rakefile
|
|
31
|
-
- README
|
|
31
|
+
- README.markdown
|
|
32
32
|
has_rdoc: false
|
|
33
33
|
homepage: http://github.com/shuber/hattr_accessor
|
|
34
34
|
post_install_message:
|