Sha256: eb81e397a691cfeed7fb37fa15d5d1edd990bb67b0e94c2d7830bfa1baea84e2

Contents?: true

Size: 631 Bytes

Versions: 85

Compression:

Stored size: 631 Bytes

Contents

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

85 entries across 85 versions & 1 rubygems

Version Path
ddr-models-2.6.2 lib/ddr/index/field.rb
ddr-models-2.6.1 lib/ddr/index/field.rb
ddr-models-2.6.0 lib/ddr/index/field.rb
ddr-models-2.6.0.rc4 lib/ddr/index/field.rb
ddr-models-2.6.0.rc3 lib/ddr/index/field.rb
ddr-models-2.6.0.rc2 lib/ddr/index/field.rb
ddr-models-2.6.0.rc1 lib/ddr/index/field.rb
ddr-models-2.5.3 lib/ddr/index/field.rb
ddr-models-2.5.2 lib/ddr/index/field.rb
ddr-models-2.5.1 lib/ddr/index/field.rb
ddr-models-2.5.0 lib/ddr/index/field.rb
ddr-models-2.5.0.rc1 lib/ddr/index/field.rb
ddr-models-2.4.16 lib/ddr/index/field.rb
ddr-models-2.4.15 lib/ddr/index/field.rb
ddr-models-2.4.14 lib/ddr/index/field.rb
ddr-models-2.4.13 lib/ddr/index/field.rb
ddr-models-2.4.12 lib/ddr/index/field.rb
ddr-models-2.4.11 lib/ddr/index/field.rb
ddr-models-3.0.8 lib/ddr/index/field.rb
ddr-models-3.0.7 lib/ddr/index/field.rb