Sha256: d48662e3cfb796818c30fd76393901f81f999a97c1b8b89aa2270476378af745

Contents?: true

Size: 493 Bytes

Versions: 5

Compression:

Stored size: 493 Bytes

Contents

class BooleanFieldType < FieldType
  attr_accessor :value

  def data=(data_hash)
    @value = data_hash.deep_symbolize_keys[: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

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

  private

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cortex-plugins-core-2.0.1 app/models/boolean_field_type.rb
cortex-plugins-core-1.1.1 app/models/boolean_field_type.rb
cortex-plugins-core-1.1.0 app/models/boolean_field_type.rb
cortex-plugins-core-1.0.0 app/models/boolean_field_type.rb
cortex-plugins-core-0.12.4 app/models/boolean_field_type.rb