Class: Fuji::Link
- Inherits:
-
Object
- Object
- Fuji::Link
- Defined in:
- lib/fuji/link.rb
Instance Method Summary collapse
- #html(current_page = nil) ⇒ Object
-
#initialize(label, url, options = {}) ⇒ Link
constructor
A new instance of Link.
Constructor Details
#initialize(label, url, options = {}) ⇒ Link
Returns a new instance of Link.
4 5 6 7 8 |
# File 'lib/fuji/link.rb', line 4 def initialize label, url, = {} @label = label @url = url @options = end |
Instance Method Details
#html(current_page = nil) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fuji/link.rb', line 10 def html current_page = nil url = mapping @url @options[:css] ||= Fuji::Helper.dehumanize(@label) css_class = [@options[:css]] css_class << "active" if current_page && current_page?(url, current_page) output = "<a href='#{url}' class='#{css_class.join(" ")}'>#{@label}</a>" output = "<li>#{output}</li>" unless @options[:skip_li] output end |