active_hash 0.8.4 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/Rakefile +14 -1
- data/VERSION +1 -1
- data/active_hash.gemspec +3 -3
- data/lib/active_hash/base.rb +9 -5
- data/spec/active_hash/base_spec.rb +10 -0
- metadata +6 -4
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
@@ -8,7 +8,20 @@ begin
|
|
8
8
|
gem.summary = %Q{An ActiveRecord-like model that uses a hash or file as a datasource}
|
9
9
|
gem.email = "jeff@zilkey.com"
|
10
10
|
gem.homepage = "http://github.com/zilkey/active_hash"
|
11
|
-
gem.authors = [
|
11
|
+
gem.authors = [
|
12
|
+
"Jeff Dean",
|
13
|
+
"Mike Dalessio",
|
14
|
+
"Corey Innis",
|
15
|
+
"Peter Jaros",
|
16
|
+
"Brandon Keene",
|
17
|
+
"Brian Takita",
|
18
|
+
"Pat Nakajima",
|
19
|
+
"John Pignata",
|
20
|
+
"Michael Schubert",
|
21
|
+
"Jeremy Weiskotten",
|
22
|
+
"Ryan Garver",
|
23
|
+
"Tom Stuart",
|
24
|
+
]
|
12
25
|
gem.add_dependency('activesupport', [">= 2.2.2"])
|
13
26
|
gem.post_install_message = "NOTE: Enums have changed to use underscores.\n\nYou may have to do a search and replace to get your suite green."
|
14
27
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.5
|
data/active_hash.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{active_hash}
|
8
|
-
s.version = "0.8.
|
8
|
+
s.version = "0.8.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Jeff Dean", "Mike Dalessio", "Corey Innis", "Peter Jaros", "Brandon Keene", "Brian Takita", "Pat Nakajima", "John Pignata", "Michael Schubert", "Jeremy Weiskotten"]
|
12
|
-
s.date = %q{2010-10-
|
11
|
+
s.authors = ["Jeff Dean", "Mike Dalessio", "Corey Innis", "Peter Jaros", "Brandon Keene", "Brian Takita", "Pat Nakajima", "John Pignata", "Michael Schubert", "Jeremy Weiskotten", "Ryan Garver", "Tom Stuart"]
|
12
|
+
s.date = %q{2010-10-20}
|
13
13
|
s.email = %q{jeff@zilkey.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE",
|
data/lib/active_hash/base.rb
CHANGED
@@ -131,7 +131,7 @@ module ActiveHash
|
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
134
|
-
def method_missing(method_name, *
|
134
|
+
def method_missing(method_name, *args)
|
135
135
|
return super unless respond_to? method_name
|
136
136
|
|
137
137
|
config = configuration_for_custom_finder(method_name)
|
@@ -198,8 +198,10 @@ module ActiveHash
|
|
198
198
|
method_name = "find_by_#{field_name}"
|
199
199
|
unless singleton_methods.include?(method_name)
|
200
200
|
the_meta_class.instance_eval do
|
201
|
-
define_method(method_name) do |
|
202
|
-
|
201
|
+
define_method(method_name) do |*args|
|
202
|
+
options = args.extract_options!
|
203
|
+
identifier = args[0]
|
204
|
+
all.detect { |record| record.send(field_name) == identifier }
|
203
205
|
end
|
204
206
|
end
|
205
207
|
end
|
@@ -212,8 +214,10 @@ module ActiveHash
|
|
212
214
|
unless singleton_methods.include?(method_name)
|
213
215
|
the_meta_class.instance_eval do
|
214
216
|
unless singleton_methods.include?(method_name)
|
215
|
-
define_method(method_name) do |
|
216
|
-
|
217
|
+
define_method(method_name) do |*args|
|
218
|
+
options = args.extract_options!
|
219
|
+
identifier = args[0]
|
220
|
+
all.select { |record| record.send(field_name) == identifier }
|
217
221
|
end
|
218
222
|
end
|
219
223
|
end
|
@@ -65,6 +65,16 @@ describe ActiveHash, "Base" do
|
|
65
65
|
Country.should_not respond_to(:find_all_by_name_and_iso_name!)
|
66
66
|
Country.should_not respond_to(:find_all_by_iso_name_and_name!)
|
67
67
|
end
|
68
|
+
|
69
|
+
it "allows you to pass options to the built-in find_by_* methods (but ignores the hash for now)" do
|
70
|
+
Country.find_by_name("Canada", :select => nil).should be_nil
|
71
|
+
Country.find_all_by_name("Canada", :select => nil).should == []
|
72
|
+
end
|
73
|
+
|
74
|
+
it "allows you to pass options to the custom find_by_* methods (but ignores the hash for now)" do
|
75
|
+
Country.find_by_name_and_iso_name("Canada", "CA", :select => nil).should be_nil
|
76
|
+
Country.find_all_by_name_and_iso_name("Canada", "CA", :select => nil).should == []
|
77
|
+
end
|
68
78
|
end
|
69
79
|
|
70
80
|
describe ".data=" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_hash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 53
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 5
|
10
|
+
version: 0.8.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jeff Dean
|
@@ -20,11 +20,13 @@ authors:
|
|
20
20
|
- John Pignata
|
21
21
|
- Michael Schubert
|
22
22
|
- Jeremy Weiskotten
|
23
|
+
- Ryan Garver
|
24
|
+
- Tom Stuart
|
23
25
|
autorequire:
|
24
26
|
bindir: bin
|
25
27
|
cert_chain: []
|
26
28
|
|
27
|
-
date: 2010-10-
|
29
|
+
date: 2010-10-20 00:00:00 -06:00
|
28
30
|
default_executable:
|
29
31
|
dependencies:
|
30
32
|
- !ruby/object:Gem::Dependency
|