Class: TusurHeader::Link
- Inherits:
-
Object
- Object
- TusurHeader::Link
- Includes:
- ActionView::Helpers
- Defined in:
- lib/tusur_header/menu_links.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(title, url, options, separator) ⇒ Link
constructor
A new instance of Link.
- #link ⇒ Object
- #separator ⇒ Object
- #separator? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(title, url, options, separator) ⇒ Link
Returns a new instance of Link.
7 8 9 |
# File 'lib/tusur_header/menu_links.rb', line 7 def initialize(title, url, , separator) @title, @url, @options, @separator = title, url, , separator end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/tusur_header/menu_links.rb', line 5 def @options end |
#title ⇒ Object
Returns the value of attribute title.
5 6 7 |
# File 'lib/tusur_header/menu_links.rb', line 5 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
5 6 7 |
# File 'lib/tusur_header/menu_links.rb', line 5 def url @url end |
Instance Method Details
#link ⇒ Object
15 16 17 |
# File 'lib/tusur_header/menu_links.rb', line 15 def link content_tag :li, link_to(title, url, ).html_safe end |
#separator ⇒ Object
23 24 25 |
# File 'lib/tusur_header/menu_links.rb', line 23 def separator content_tag :li, nil, class: 'divider' end |
#separator? ⇒ Boolean
19 20 21 |
# File 'lib/tusur_header/menu_links.rb', line 19 def separator? !!@separator end |
#to_s ⇒ Object
11 12 13 |
# File 'lib/tusur_header/menu_links.rb', line 11 def to_s (separator? ? separator : link) rescue '' end |