lib/json/generator/attribute_factory.rb in json-generator-0.0.1 vs lib/json/generator/attribute_factory.rb in json-generator-0.1.0
- old
+ new
@@ -1,15 +1,18 @@
+# encoding: utf-8
+
module JSON
module Generator
class AttributeFactory
CLASSES = {
'string' => StringAttribute,
'object' => ObjectAttribute,
'integer' => IntegerAttribute,
'array' => ArrayAttribute,
'boolean' => BooleanAttribute,
- nil => EmptyAttribute
+ 'number' => NumberAttribute,
}
+ CLASSES.default = EmptyAttribute
def self.create(properties)
CLASSES[Array(properties['type']).first].new(properties)
end
end