Class: JSON::Generator::AttributeFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/json/generator/attribute_factory.rb

Constant Summary collapse

CLASSES =
{
  'string' => StringAttribute,
  'object' => ObjectAttribute,
  'integer' => IntegerAttribute,
  'array' => ArrayAttribute,
  'boolean' => BooleanAttribute,
  nil => EmptyAttribute
}

Class Method Summary collapse

Class Method Details

.create(properties) ⇒ Object



13
14
15
# File 'lib/json/generator/attribute_factory.rb', line 13

def self.create(properties)
  CLASSES[Array(properties['type']).first].new(properties)
end