Class: Bootstrap::ActiveLinkTo::ActiveLink
- Inherits:
-
Object
- Object
- Bootstrap::ActiveLinkTo::ActiveLink
- Defined in:
- lib/bootstrap/active_link_to.rb
Constant Summary collapse
- ACTIVE_OPTIONS =
[:active, :class_active, :class_inactive, :active_disable]
Instance Method Summary collapse
-
#initialize(context) ⇒ ActiveLink
constructor
A new instance of ActiveLink.
- #render(*args, &block) ⇒ Object
Constructor Details
#initialize(context) ⇒ ActiveLink
Returns a new instance of ActiveLink.
8 9 10 |
# File 'lib/bootstrap/active_link_to.rb', line 8 def initialize(context) @context = context end |
Instance Method Details
#render(*args, &block) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/bootstrap/active_link_to.rb', line 12 def render(*args, &block) @name = block_given? ? capture(&block) : args.shift @link_options = args. @url = h.url_for(args.shift) @active_options = @link_options.extract!(*ACTIVE_OPTIONS).only_presented @after_link = @link_options.delete(:after_link).to_s if is_wrap? provide_wrap_with_content! else @link_options.smart_append_to :class, active_class content end end |