Class: Spectifly::Json::Builder
- Inherits:
-
Base::Builder
- Object
- Base::Builder
- Spectifly::Json::Builder
- Defined in:
- lib/spectifly/json/builder.rb
Instance Method Summary collapse
Methods inherited from Base::Builder
#association_class, #associations, #custom_types, #field_class, #fields, from_path, #initialize, module_name, #native_types, #present_as, #root, #types, #utilized_extended_type_fields, #utilized_extended_types
Constructor Details
This class inherits a constructor from Spectifly::Base::Builder
Instance Method Details
#build ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/spectifly/json/builder.rb', line 8 def build field_hashes = {} associations.each do |association| field_hashes[association.relationship] ||= {} field_hashes[association.relationship].merge! association.to_h end fields.each do |field| field_hashes.merge! field.to_h end { Spectifly::Support.tokenize(root) => field_hashes } end |