Class: JSON::Generator::ObjectAttribute
- Inherits:
-
BasicAttribute
- Object
- BasicAttribute
- JSON::Generator::ObjectAttribute
- Defined in:
- lib/json/generator/object_attribute.rb
Instance Method Summary collapse
Methods inherited from BasicAttribute
Constructor Details
This class inherits a constructor from JSON::Generator::BasicAttribute
Instance Method Details
#generate ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/json/generator/object_attribute.rb', line 4 def generate return nil unless required? return {} unless @attributes.has_key?('properties') @attributes['properties'].inject({}) do |json, (property_name, property_attributes)| attribute = AttributeFactory.create(property_attributes) if attribute.required? json[property_name] = attribute.generate end json end end |