Class: TextFieldType

Inherits:
FieldType
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#dataObject

Returns the value of attribute data.



7
8
9
# File 'app/models/text_field_type.rb', line 7

def data
  @data
end

#field_nameObject

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

#metadataObject

Returns the value of attribute metadata.



8
9
10
# File 'app/models/text_field_type.rb', line 8

def 
  
end

#textObject

Returns the value of attribute text.



7
8
9
# File 'app/models/text_field_type.rb', line 7

def text
  @text
end

#validationsObject

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

Returns:

  • (Boolean)


25
26
27
# File 'app/models/text_field_type.rb', line 25

def acceptable_validations?
  valid_types? && valid_options?
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, options = {})
  json = {}
  json[mapping_field_name] = field_item.data['text']
  json
end

#mappingObject



35
36
37
# File 'app/models/text_field_type.rb', line 35

def mapping
  {name: mapping_field_name, type: :string, analyzer: :snowball}
end