Class: Bootstrap4Helper::CardGrouping

Inherits:
Component
  • Object
show all
Defined in:
lib/bootstrap4_helper/card_grouping.rb

Overview

Class for other Card group type components to inherit from.

Direct Known Subclasses

CardColumn, CardDeck, CardGroup

Instance Method Summary collapse

Methods inherited from Component

#capture, #concat, #config, #content_tag, #parse_arguments, #uuid

Constructor Details

#initialize(template, opts = {}, &block) ⇒ Card

Used to initialize a new Card Grouping.

Options Hash (opts):

  • :id (String)
  • :class (String)
  • :data (Hash)


15
16
17
18
19
20
21
22
# File 'lib/bootstrap4_helper/card_grouping.rb', line 15

def initialize(template, opts = {}, &block)
  super(template)

  @id      = opts.fetch(:id,    '')
  @class   = opts.fetch(:class, '')
  @data    = opts.fetch(:data,  nil)
  @content = block || proc { '' }
end

Instance Method Details

#card(opts = {}, &block) ⇒ Card

Builds a ‘Card` for the grouping class.



29
30
31
# File 'lib/bootstrap4_helper/card_grouping.rb', line 29

def card(opts = {}, &block)
  Card.new(@template, opts, &block)
end