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.11.0 lib/ddr/index/field.rb
ddr-models-2.10.2 lib/ddr/index/field.rb
ddr-models-2.10.1 lib/ddr/index/field.rb
ddr-models-2.10.0 lib/ddr/index/field.rb
ddr-models-2.10.0.rc2 lib/ddr/index/field.rb
ddr-models-2.10.0.rc1 lib/ddr/index/field.rb
ddr-models-2.9.2 lib/ddr/index/field.rb
ddr-models-2.9.1 lib/ddr/index/field.rb
ddr-models-2.9.0 lib/ddr/index/field.rb
ddr-models-2.9.0.rc1 lib/ddr/index/field.rb
ddr-models-2.8.0 lib/ddr/index/field.rb
ddr-models-2.8.0.rc1 lib/ddr/index/field.rb
ddr-models-2.7.6 lib/ddr/index/field.rb
ddr-models-2.7.5 lib/ddr/index/field.rb
ddr-models-2.7.4 lib/ddr/index/field.rb
ddr-models-2.7.3 lib/ddr/index/field.rb
ddr-models-2.7.2 lib/ddr/index/field.rb
ddr-models-2.7.1 lib/ddr/index/field.rb
ddr-models-2.7.0 lib/ddr/index/field.rb
ddr-models-2.7.0.rc1 lib/ddr/index/field.rb