Class: Ddr::Index::Field
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Ddr::Index::Field
- Defined in:
- lib/ddr/index/field.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
Instance Method Summary collapse
- #heading ⇒ Object
-
#initialize(base, *args) ⇒ Field
constructor
A new instance of Field.
- #label ⇒ Object
Constructor Details
#initialize(base, *args) ⇒ Field
Returns a new instance of Field.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ddr/index/field.rb', line 8 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 |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
6 7 8 |
# File 'lib/ddr/index/field.rb', line 6 def base @base end |
Instance Method Details
#heading ⇒ Object
24 25 26 |
# File 'lib/ddr/index/field.rb', line 24 def heading I18n.t "#{i18n_base}.heading", default: base end |
#label ⇒ Object
20 21 22 |
# File 'lib/ddr/index/field.rb', line 20 def label I18n.t "#{i18n_base}.label", default: base.titleize end |