Class: Syphon::Schema::NestedField
Instance Attribute Summary collapse
-
#nested_schema ⇒ Object
readonly
Returns the value of attribute nested_schema.
Attributes inherited from Field
#expression, #name, #schema, #type
Instance Method Summary collapse
-
#initialize(schema, name, options = {}, &block) ⇒ NestedField
constructor
A new instance of NestedField.
- #properties ⇒ Object
- #select ⇒ Object
Methods inherited from Field
Constructor Details
#initialize(schema, name, options = {}, &block) ⇒ NestedField
Returns a new instance of NestedField.
109 110 111 112 |
# File 'lib/syphon/schema.rb', line 109 def initialize(schema, name, = {}, &block) super(schema, name, :nested, nil, ) @nested_schema = Schema.new(&block) end |
Instance Attribute Details
#nested_schema ⇒ Object (readonly)
Returns the value of attribute nested_schema.
114 115 116 |
# File 'lib/syphon/schema.rb', line 114 def nested_schema @nested_schema end |
Instance Method Details
#properties ⇒ Object
116 117 118 |
# File 'lib/syphon/schema.rb', line 116 def properties super.merge(properties: nested_schema.properties) end |
#select ⇒ Object
120 121 122 |
# File 'lib/syphon/schema.rb', line 120 def select nested_schema.fields.map { |n, f| f.select(name) }.join(', ') end |