Sha256: 1e67a19f2f0c15ec934da8b9c3d79dc70786d35d0ac0b63ca3f56e588df38586

Contents?: true

Size: 476 Bytes

Versions: 3

Compression:

Stored size: 476 Bytes

Contents

class BooleanFieldType < Cortex::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

3 entries across 3 versions & 1 rubygems

Version Path
cortex-plugins-core-3.2.0 app/models/boolean_field_type.rb
cortex-plugins-core-3.1.0 app/models/boolean_field_type.rb
cortex-plugins-core-3.0.0 app/models/boolean_field_type.rb