Class: Shoehorn::Components::Alert

Inherits:
Base
  • Object
show all
Defined in:
lib/shoehorn/components/alert.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#options, #output_buffer

Instance Method Summary collapse

Constructor Details

#initialize(message, options = {}) ⇒ Alert

Returns a new instance of Alert.



5
6
7
8
# File 'lib/shoehorn/components/alert.rb', line 5

def initialize(message, options = {})
  super
  @message = message
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



3
4
5
# File 'lib/shoehorn/components/alert.rb', line 3

def message
  @message
end

Instance Method Details

#to_sObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/shoehorn/components/alert.rb', line 10

def to_s
  output_buffer << (:div, build_div_options) do
    html = ""
    html << build_close_tag.html_safe   if options[:close]
    html << build_heading_tag.html_safe if options[:heading]
    html << message
    html.html_safe
  end.html_safe
  super
end