ruby-imdb 0.7.1 → 0.7.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/VERSION +1 -1
- data/lib/imdb/skeleton.rb +13 -10
- data/ruby-imdb.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.2
|
data/lib/imdb/skeleton.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module IMDB
|
2
|
-
#
|
2
|
+
# IMDB generic interface.
|
3
3
|
class Skeleton
|
4
4
|
attr_accessor :model, :method_names
|
5
5
|
|
@@ -9,8 +9,8 @@ module IMDB
|
|
9
9
|
include MongoMapper::Document
|
10
10
|
set_collection_name model_name
|
11
11
|
method_names.each { |m, t|
|
12
|
-
|
13
|
-
|
12
|
+
key m, t
|
13
|
+
}
|
14
14
|
end
|
15
15
|
class_eval do
|
16
16
|
method_names.each_key { |meth|
|
@@ -31,11 +31,14 @@ module IMDB
|
|
31
31
|
a = send(old_meth)
|
32
32
|
if a.kind_of?(Array)
|
33
33
|
a.compact!
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
34
|
+
a.map! { |c|
|
35
|
+
if c.kind_of?(String)
|
36
|
+
c
|
37
|
+
else
|
38
|
+
c.to_hash
|
39
|
+
end
|
40
|
+
}
|
41
|
+
@db_query[meth] = a
|
39
42
|
else
|
40
43
|
@db_query[meth] = a
|
41
44
|
end
|
@@ -57,7 +60,6 @@ module IMDB
|
|
57
60
|
tmp_hash.to_json(*a)
|
58
61
|
end
|
59
62
|
|
60
|
-
|
61
63
|
def to_hash(*a)
|
62
64
|
tmp_hash = {}
|
63
65
|
@method_names.each_key { |x|
|
@@ -77,4 +79,5 @@ module IMDB
|
|
77
79
|
new(*o['data'])
|
78
80
|
end
|
79
81
|
end
|
80
|
-
end
|
82
|
+
end
|
83
|
+
|
data/ruby-imdb.gemspec
CHANGED