Class: Bootstrap5Helper::PageHeader
- Defined in:
- lib/bootstrap5_helper/page_header.rb
Overview
Builds a simple CSS spinner component.
Instance Method Summary collapse
-
#initialize(template, tag_or_options = nil, opts = {}, &block) ⇒ PageHeader
constructor
Class constructor.
-
#to_s ⇒ String
String representation of the object.
Methods inherited from Component
#capture, #concat, #config, #content_tag, #parse_arguments, #parse_context_or_options, #parse_tag_or_options, #parse_text_or_options, #uuid
Constructor Details
#initialize(template, tag_or_options = nil, opts = {}, &block) ⇒ PageHeader
Class constructor
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/bootstrap5_helper/page_header.rb', line 15 def initialize(template, = nil, opts = {}, &block) super(template) @tag, args = (, opts) @tag ||= config(:page_header, :h1) @id = args.fetch(:id, uuid) @class = args.fetch(:class, '') @data = args.fetch(:data, {}) @content = block || proc { '' } end |
Instance Method Details
#to_s ⇒ String
String representation of the object.
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/bootstrap5_helper/page_header.rb', line 31 def to_s content_tag( @tag, id: @id, class: "pb-2 mt-4 mb-2 border-bottom #{@class}", data: @data ) do @content.call(self) end end |