Class: BooleanFieldType

Inherits:
Cortex::FieldType
  • Object
show all
Defined in:
app/models/boolean_field_type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#valueObject

Returns the value of attribute value.



2
3
4
# File 'app/models/boolean_field_type.rb', line 2

def value
  @value
end

Instance Method Details

#data=(data_hash) ⇒ Object



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

def data=(data_hash)
  @value = data_hash['value']
end

#elasticsearch_mappingObject



4
5
6
# File 'app/models/boolean_field_type.rb', line 4

def elasticsearch_mapping
  { name: mapping_field_name, type: :boolean }
end

#field_item_as_indexed_json_for_field_type(field_item, options = {}) ⇒ Object



12
13
14
15
16
# File 'app/models/boolean_field_type.rb', line 12

def field_item_as_indexed_json_for_field_type(field_item, options = {})
  json = {}
  json[mapping_field_name] = field_item.data['value']
  json
end