class Bootstrap4Helper::PageHeader
Builds a simple CSS spinner component.
Public Class Methods
new(template, opts = {}, &block)
click to toggle source
Class constructor
@param [ActionView] template @param [Hash] opts @option opts [symbol] :type @option opts [String] :id @option opts [String] :class @option opts [Hash] :data
Calls superclass method
Bootstrap4Helper::Component::new
# File lib/bootstrap4_helper/page_header.rb, line 15 def initialize(template, opts = {}, &block) super(template) @type = opts.fetch(:type, nil) @id = opts.fetch(:id, uuid) @class = opts.fetch(:class, '') @data = opts.fetch(:data, {}) @content = block || proc { '' } end
Public Instance Methods
to_s()
click to toggle source
String representation of the object.
@return [String]
# File lib/bootstrap4_helper/page_header.rb, line 29 def to_s content_tag( @type || config(:page_header, :h1), id: @id, class: "pb-2 mt-4 mb-2 border-bottom #{@class}", data: @data ) do @content.call(self) end end