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.4.0 lib/ddr/index/field.rb
ddr-models-2.4.0.rc6 lib/ddr/index/field.rb
ddr-models-2.4.0.rc5 lib/ddr/index/field.rb
ddr-models-2.4.0.rc4 lib/ddr/index/field.rb
ddr-models-2.4.0.rc3 lib/ddr/index/field.rb