Module: Dry::ElasticModel::Schema
- Includes:
- Types
- Included in:
- Base
- Defined in:
- lib/dry/elastic_model/schema.rb
Constant Summary
Constants included
from Types
Types::Array, Types::BYTE_LIMIT, Types::Binary, Types::Boolean, Types::Byte, Types::Date, Types::DateTime, Types::Double, Types::Float, Types::HalfFloat, Types::INTEGER_LIMIT, Types::IP, Types::Integer, Types::Keyword, Types::LONG_LIMIT, Types::Long, Types::MAX_UNIX_TIME, Types::ObjectType, Types::RANGE_KEYS, Types::RANGE_TYPES, Types::Range, Types::SHORT_LIMIT, Types::ScaledFloat, Types::Short, Types::TYPES, Types::Text
Instance Method Summary
collapse
Instance Method Details
#mapping ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/dry/elastic_model/schema.rb', line 8
def mapping
{
name.downcase.to_sym => {
properties: schema.inject({}) do |h, type|
attr = type.name
definition = type.lax
opts = definition.meta.fetch(:opts, {})
h.merge(
attr => { type: definition.meta.fetch(:es_name) }.merge(opts)
)
end
}
}
end
|
#parse_definition(definition) ⇒ Object
25
26
27
|
# File 'lib/dry/elastic_model/schema.rb', line 25
def parse_definition(definition)
definition.meta[:es_name]
end
|