Class: TextFieldType
- Inherits:
-
FieldType
- Object
- FieldType
- TextFieldType
- Defined in:
- app/models/text_field_type.rb
Constant Summary collapse
- VALIDATION_TYPES =
{ length: :valid_length_validation?, presence: :valid_presence_validation? }.freeze
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#field_name ⇒ Object
Returns the value of attribute field_name.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#text ⇒ Object
Returns the value of attribute text.
-
#validations ⇒ Object
Returns the value of attribute validations.
Instance Method Summary collapse
- #acceptable_validations? ⇒ Boolean
- #field_item_as_indexed_json_for_field_type(field_item, options = {}) ⇒ Object
- #mapping ⇒ Object
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
7 8 9 |
# File 'app/models/text_field_type.rb', line 7 def data @data end |
#field_name ⇒ Object
Returns the value of attribute field_name.
7 8 9 |
# File 'app/models/text_field_type.rb', line 7 def field_name @field_name end |
#metadata ⇒ Object
Returns the value of attribute metadata.
8 9 10 |
# File 'app/models/text_field_type.rb', line 8 def end |
#text ⇒ Object
Returns the value of attribute text.
7 8 9 |
# File 'app/models/text_field_type.rb', line 7 def text @text end |
#validations ⇒ Object
Returns the value of attribute validations.
8 9 10 |
# File 'app/models/text_field_type.rb', line 8 def validations @validations end |
Instance Method Details
#acceptable_validations? ⇒ Boolean
25 26 27 |
# File 'app/models/text_field_type.rb', line 25 def acceptable_validations? valid_types? && end |
#field_item_as_indexed_json_for_field_type(field_item, options = {}) ⇒ Object
29 30 31 32 33 |
# File 'app/models/text_field_type.rb', line 29 def field_item_as_indexed_json_for_field_type(field_item, = {}) json = {} json[mapping_field_name] = field_item.data['text'] json end |
#mapping ⇒ Object
35 36 37 |
# File 'app/models/text_field_type.rb', line 35 def mapping {name: mapping_field_name, type: :string, analyzer: :snowball} end |