Class: ROM::Elasticsearch::Schema
- Inherits:
-
Schema
- Object
- Schema
- ROM::Elasticsearch::Schema
- Defined in:
- lib/rom/elasticsearch/schema.rb
Overview
Elasticsearch relation schema
Instance Method Summary collapse
-
#to_output_hash ⇒ Object
private
Customized output hash constructor which symbolizes keys and optionally applies custom read-type coercions.
-
#to_properties ⇒ Object
private
Return a hash with mapping properties.
Instance Method Details
#to_output_hash ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Customized output hash constructor which symbolizes keys and optionally applies custom read-type coercions
23 24 25 26 27 |
# File 'lib/rom/elasticsearch/schema.rb', line 23 def to_output_hash Types::Hash .schema(map { |attr| [attr.key, attr.to_read_type] }.to_h) .with_key_transform(&:to_sym) end |
#to_properties ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return a hash with mapping properties
15 16 17 |
# File 'lib/rom/elasticsearch/schema.rb', line 15 def to_properties select(&:properties?).map { |attr| [attr.name, attr.properties] }.to_h end |