Class: It::Link
- Inherits:
-
Tag
- Object
- Tag
- It::Link
- Includes:
- ActionView::Helpers::UrlHelper
- Defined in:
- lib/it/link.rb
Overview
A class for links
Instance Attribute Summary
Attributes inherited from Tag
Instance Method Summary (collapse)
-
- (Link) initialize(href, options = {})
constructor
See It.link for details.
-
- (Object) process(content)
Will be called from inside the helper to return the tag with the given content.
Constructor Details
- (Link) initialize(href, options = {})
See It.link for details. You can do everything there and save 6 characters.
7 8 9 10 11 |
# File 'lib/it/link.rb', line 7 def initialize(href, = {}) raise TypeError, "Invalid href given" unless href.is_a?(Hash) || href.is_a?(String) super(:a, ) @href = href end |
Instance Method Details
- (Object) process(content)
Will be called from inside the helper to return the tag with the given content.
14 15 16 |
# File 'lib/it/link.rb', line 14 def process(content) link_to(content, @href, @options) end |