MasterRecord 0.3.1 → 0.3.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 +4 -0
- data/MasterRecord.gemspec +1 -1
- data/VERSION +1 -1
- data/lib/MasterRecord.rb +3 -1
- data/spec/MasterRecord_spec.rb +1 -0
- metadata +10 -10
data/ChangeLog
CHANGED
@@ -1,3 +1,7 @@
|
|
1
1
|
0.3.1
|
2
2
|
* add attributes method (ex Item.find_one_by_price(40).attributes => {:id => "2",:identity => "Item@2",:name => "チョコレート",:price => 40})
|
3
3
|
* add []access (ex Item.find_one_by_price(50)[:id] => "3")
|
4
|
+
|
5
|
+
0.3.2
|
6
|
+
* modify bug when use find_one with no condition
|
7
|
+
* no raise error when find ,find_one with no record define.
|
data/MasterRecord.gemspec
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/lib/MasterRecord.rb
CHANGED
@@ -33,6 +33,8 @@ module MasterRecord
|
|
33
33
|
klass = Object.const_get("#{c}Data")
|
34
34
|
master_records = klass.const_get("#{c}Records")
|
35
35
|
c.instance_variable_set("@master_records",master_records)
|
36
|
+
else
|
37
|
+
c.instance_variable_set("@master_records",{})
|
36
38
|
end
|
37
39
|
|
38
40
|
fields.keys.each do |f|
|
@@ -74,7 +76,7 @@ module MasterRecord
|
|
74
76
|
if @master_records.count == 0
|
75
77
|
return nil
|
76
78
|
else
|
77
|
-
return new(@master_records.first)
|
79
|
+
return new(@master_records.keys.first)
|
78
80
|
end
|
79
81
|
end
|
80
82
|
if condition.is_a? Hash
|
data/spec/MasterRecord_spec.rb
CHANGED
@@ -40,6 +40,7 @@ describe "Masterrecord" do
|
|
40
40
|
it{ User.find(:name => "たけし",:age => 21).should == []}
|
41
41
|
it{ User.find(:name => "たけし",:age => 20).count.should == 1}
|
42
42
|
it{ User.find_one(:name => "たけし",:age => 20).id.should == "2"}
|
43
|
+
it{ User.find_one().id.should == "1"}
|
43
44
|
end
|
44
45
|
describe "tsv" do
|
45
46
|
before do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: MasterRecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-12-20 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &14004580 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.3.0
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *14004580
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bundler
|
27
|
-
requirement: &
|
27
|
+
requirement: &14003420 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.0.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *14003420
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: jeweler
|
38
|
-
requirement: &
|
38
|
+
requirement: &14002800 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.6.4
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *14002800
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rcov
|
49
|
-
requirement: &
|
49
|
+
requirement: &14002180 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *14002180
|
58
58
|
description: Object Mapper for csv or tsv or yaml etc.. you can use find,find_one_by|field|,find_by_|field|
|
59
59
|
email: laten@nifty.com
|
60
60
|
executables: []
|
@@ -98,7 +98,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
98
|
version: '0'
|
99
99
|
segments:
|
100
100
|
- 0
|
101
|
-
hash:
|
101
|
+
hash: 808747776690844342
|
102
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
103
|
none: false
|
104
104
|
requirements:
|