Class: MenuItem
Direct Known Subclasses
Instance Attribute Summary collapse
-
#href ⇒ Object
readonly
Returns the value of attribute href.
Instance Method Summary collapse
- #display ⇒ Object
-
#initialize(name, href) ⇒ MenuItem
constructor
A new instance of MenuItem.
- #to_html ⇒ Object
Constructor Details
#initialize(name, href) ⇒ MenuItem
Returns a new instance of MenuItem.
4 5 6 7 |
# File 'app/models/menu_item.rb', line 4 def initialize(name, href) @name = name @href = href end |
Instance Attribute Details
#href ⇒ Object (readonly)
Returns the value of attribute href.
9 10 11 |
# File 'app/models/menu_item.rb', line 9 def href @href end |
Instance Method Details
#display ⇒ Object
11 12 13 |
# File 'app/models/menu_item.rb', line 11 def display h @name end |
#to_html ⇒ Object
15 16 17 |
# File 'app/models/menu_item.rb', line 15 def to_html "<li><a href=\"#{href}\">#{display}</a></li>".html_safe end |