kit 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/kit.rb +4 -2
- data/lib/kit/bit.rb +1 -1
- metadata +2 -2
data/lib/kit.rb
CHANGED
@@ -85,9 +85,11 @@ class Kit
|
|
85
85
|
if info.is_a? Integer
|
86
86
|
Bit.new info
|
87
87
|
elsif info.is_a? Hash
|
88
|
-
|
88
|
+
ids = Bit::lookup_id info
|
89
|
+
raise Bit::DuplicateElement unless ids.length == 1
|
90
|
+
Bit.new ids.first
|
89
91
|
end
|
90
|
-
rescue Bit::NoElement
|
92
|
+
rescue Bit::NoElement, Bit::DuplicateElement
|
91
93
|
nil
|
92
94
|
end
|
93
95
|
end
|
data/lib/kit/bit.rb
CHANGED
@@ -74,7 +74,7 @@ class Bit < Kit
|
|
74
74
|
uniq = @@unique[:bits].hash_ivars self
|
75
75
|
uniq.each { |x| fail MissingValues if x.nil? }
|
76
76
|
|
77
|
-
fail DuplicateElement if lookup_id uniq
|
77
|
+
fail DuplicateElement if ( lookup_id uniq ).first
|
78
78
|
|
79
79
|
data = @@info[:bits].hash_ivars self, [ :rowid ]
|
80
80
|
@@db.insert_info :bits, data
|