Class: GovukComponent::Base
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- GovukComponent::Base
- Defined in:
- app/components/govuk_component/base.rb
Direct Known Subclasses
Accordion, BackLink, Breadcrumbs, Details, Footer, Header, InsetText, NotificationBanner, Panel, PhaseBanner, StartNowButton, SummaryList, Tabs, Tag, Warning
Instance Attribute Summary
Attributes included from Traits::CustomHtmlAttributes
Class Method Summary collapse
-
.wrap_slot(name) ⇒ Object
Redirect #add_name to #slot(:name) to make building components with slots feel more DSL-like.
Instance Method Summary collapse
-
#initialize(classes: [], html_attributes: {}) ⇒ Base
constructor
A new instance of Base.
Methods included from Traits::CustomClasses
Constructor Details
#initialize(classes: [], html_attributes: {}) ⇒ Base
Returns a new instance of Base.
5 6 7 8 |
# File 'app/components/govuk_component/base.rb', line 5 def initialize(classes: [], html_attributes: {}) @classes = parse_classes(classes) @html_attributes = html_attributes end |
Class Method Details
.wrap_slot(name) ⇒ Object
Redirect #add_name to #slot(:name) to make building components with slots feel more DSL-like
12 13 14 15 16 |
# File 'app/components/govuk_component/base.rb', line 12 def self.wrap_slot(name) define_method(%(add_#{name})) do |*args, **kwargs, &block| slot(name, *args, **kwargs, &block) end end |