Class: Geoblacklight::HeaderBadgeComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Geoblacklight::HeaderBadgeComponent
- Defined in:
- app/components/geoblacklight/header_badge_component.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#field ⇒ Object
readonly
Returns the value of attribute field.
Instance Method Summary collapse
- #icon(field) ⇒ Object
-
#initialize(document:, field:) ⇒ HeaderBadgeComponent
constructor
A new instance of HeaderBadgeComponent.
- #label ⇒ Object
Constructor Details
#initialize(document:, field:) ⇒ HeaderBadgeComponent
Returns a new instance of HeaderBadgeComponent.
7 8 9 10 11 |
# File 'app/components/geoblacklight/header_badge_component.rb', line 7 def initialize(document:, field:) @document = document @field = field super() end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
5 6 7 |
# File 'app/components/geoblacklight/header_badge_component.rb', line 5 def document @document end |
#field ⇒ Object (readonly)
Returns the value of attribute field.
5 6 7 |
# File 'app/components/geoblacklight/header_badge_component.rb', line 5 def field @field end |
Instance Method Details
#icon(field) ⇒ Object
17 18 19 |
# File 'app/components/geoblacklight/header_badge_component.rb', line 17 def icon(field) helpers.geoblacklight_icon(label) end |
#label ⇒ Object
13 14 15 |
# File 'app/components/geoblacklight/header_badge_component.rb', line 13 def label @document[field] end |