mogli 0.0.11 → 0.0.12
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/lib/mogli.rb +1 -0
- data/lib/mogli/client.rb +4 -4
- data/lib/mogli/model.rb +3 -0
- metadata +1 -1
data/lib/mogli.rb
CHANGED
data/lib/mogli/client.rb
CHANGED
@@ -102,15 +102,15 @@ module Mogli
|
|
102
102
|
end
|
103
103
|
|
104
104
|
def create_instance(klass,data)
|
105
|
-
|
106
|
-
if
|
105
|
+
klass_to_create = determine_class(data["type"]||klass,data)
|
106
|
+
if klass_to_create.nil?
|
107
107
|
raise UnrecognizeableClassError.new("unable to recognize klass for #{klass.inspect} => #{data.inspect}")
|
108
108
|
end
|
109
|
-
|
109
|
+
klass_to_create.new(data,self)
|
110
110
|
end
|
111
111
|
|
112
112
|
def constantize_string(klass)
|
113
|
-
klass.is_a?(String) ? Mogli.const_get(klass) : klass
|
113
|
+
klass.is_a?(String) ? Mogli.const_get(klass.capitalize) : klass
|
114
114
|
end
|
115
115
|
|
116
116
|
def determine_class(klass_or_klasses,data)
|
data/lib/mogli/model.rb
CHANGED