Class: Shoehorn::Components::Button
- Includes:
- ActionView::Helpers::UrlHelper
- Defined in:
- lib/shoehorn/components/button.rb
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(text, link, options = {}) ⇒ Button
constructor
A new instance of Button.
- #to_s ⇒ Object
Constructor Details
#initialize(text, link, options = {}) ⇒ Button
Returns a new instance of Button.
7 8 9 10 11 |
# File 'lib/shoehorn/components/button.rb', line 7 def initialize(text, link, = {}) super @text = text @link = url_for(link) end |
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
5 6 7 |
# File 'lib/shoehorn/components/button.rb', line 5 def text @text end |
Instance Method Details
#to_s ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/shoehorn/components/button.rb', line 13 def to_s html_text = "" if [:icon_name] html_text << build_icon.html_safe else html_text << text end html_text << ' ' << build_caret.html_safe if [:dropdown] output_buffer << content_tag(:a, html_text.html_safe, ).html_safe super end |