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