Class: PostRunner::NavButtonRow::Button
- Inherits:
-
Object
- Object
- PostRunner::NavButtonRow::Button
- Defined in:
- lib/postrunner/NavButtonRow.rb
Overview
A class to store the icon and URL of a button in the NavButtonRow objects.
Instance Method Summary collapse
-
#initialize(icon, url = nil) ⇒ Button
constructor
Create a Button object.
-
#to_html(doc) ⇒ Object
Add the object as HTML Elements to the document.
Constructor Details
#initialize(icon, url = nil) ⇒ Button
Create a Button object.
32 33 34 35 |
# File 'lib/postrunner/NavButtonRow.rb', line 32 def initialize(icon, url = nil) @icon = icon @url = url end |
Instance Method Details
#to_html(doc) ⇒ Object
Add the object as HTML Elements to the document.
39 40 41 42 43 44 45 46 47 |
# File 'lib/postrunner/NavButtonRow.rb', line 39 def to_html(doc) if @url doc.a({ :href => @url }) { doc.img({ :src => "icons/#{@icon}", :class => 'active_button' }) } else doc.img({ :src => "icons/#{@icon}", :class => 'inactive_button' }) end end |