Sha256: ff91fd0787b44735669d469a1bc0718225997ff8958d4b95b85bc48504ee9f64

Contents?: true

Size: 651 Bytes

Versions: 43

Compression:

Stored size: 651 Bytes

Contents

require 'solrizer'

module Ddr::Index
  class Field < SimpleDelegator

    attr_reader :base

    def initialize(base, *args)
      @base = base.to_s
      name = if args.empty?
               @base
             elsif args.last.is_a?(Hash) && args.last[:solr_name]
               args.last[:solr_name]
             else
               Solrizer.solr_name(base, *args)
             end
      super(name)
    end

    def label
      I18n.t "#{i18n_base}.label", default: base.titleize
    end

    def heading
      I18n.t "#{i18n_base}.heading", default: base
    end

    private

    def i18n_base
      "ddr.index.fields.#{base}"
    end

  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
ddr-core-1.17.0 lib/ddr/index/field.rb
ddr-core-1.16.0 lib/ddr/index/field.rb
ddr-core-1.15.0 lib/ddr/index/field.rb
ddr-core-1.14.0 lib/ddr/index/field.rb
ddr-core-1.13.2 lib/ddr/index/field.rb
ddr-core-1.13.1 lib/ddr/index/field.rb
ddr-core-1.13.0 lib/ddr/index/field.rb
ddr-core-1.12.2 lib/ddr/index/field.rb
ddr-core-1.12.1 lib/ddr/index/field.rb
ddr-core-1.12.0 lib/ddr/index/field.rb
ddr-core-1.11.0 lib/ddr/index/field.rb
ddr-core-1.10.0 lib/ddr/index/field.rb
ddr-core-1.9.0 lib/ddr/index/field.rb
ddr-core-1.8.0 lib/ddr/index/field.rb
ddr-core-1.7.0 lib/ddr/index/field.rb
ddr-core-1.6.6 lib/ddr/index/field.rb
ddr-core-1.6.5 lib/ddr/index/field.rb
ddr-core-1.6.4 lib/ddr/index/field.rb
ddr-core-1.6.3 lib/ddr/index/field.rb
ddr-core-1.6.2 lib/ddr/index/field.rb