Sha256: d6d7f3af6ecda0b5d6db633a86fa5efaf61e4c48b29695cbe67407c4eb47b109

Contents?: true

Size: 468 Bytes

Versions: 2

Compression:

Stored size: 468 Bytes

Contents

class BooleanFieldType < FieldType
  attr_accessor :value

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

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

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

  private

  def mapping_field_name
    "#{field_name.parameterize(separator: '_')}_boolean"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cortex-plugins-core-2.1.1 app/models/boolean_field_type.rb
cortex-plugins-core-2.1.0 app/models/boolean_field_type.rb