class Bootstrap3Helper::Callout

Used to generate Bootstrap callout component quickly.

Public Class Methods

new(template, context_or_options = nil, opts = {}, &block) click to toggle source

@param [Class] template - Template in which your are binding too. @param [NilClass|String|Symbol|Hash] - Bootstrap class context, or options hash. @param [Hash] opts @option opts [String] :id The ID of the element @option opts [String] :class Custom class for the component. @return [Callout]

Calls superclass method
# File lib/bootstrap3_helper/callout.rb, line 13
def initialize(template, context_or_options = nil, opts = {}, &block)
  super(template)
  @context, args = parse_arguments(context_or_options, opts)

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

Public Instance Methods

to_s() click to toggle source

Returns a string representation of the component.

@return [String]

# File lib/bootstrap3_helper/callout.rb, line 26
def to_s
  content_tag :div, id: @id, class: container_class do
    @content.call(self)
  end
end

Private Instance Methods

container_class() click to toggle source

Used to get the container classes.

@return [String]

# File lib/bootstrap3_helper/callout.rb, line 38
def container_class
  string = 'callout '
  string += "callout-#{@context}"
  string += " #{@class}"
  string
end