Class: HS::Link
Instance Attribute Summary collapse
-
#to ⇒ Object
Returns the value of attribute to.
Attributes inherited from Element
#children, #class_name, #style
Instance Method Summary collapse
Methods inherited from Element
Methods included from ElementPreview
#element_preview, #text_preview
Constructor Details
This class inherits a constructor from HS::Element
Instance Attribute Details
#to ⇒ Object
Returns the value of attribute to.
5 6 7 |
# File 'lib/hs/elements/link.rb', line 5 def to @to end |
Instance Method Details
#href ⇒ Object
15 16 17 18 19 |
# File 'lib/hs/elements/link.rb', line 15 def href return to if to =~ %r{^http(s)?://} return to if to.start_with?('/') "/#{to}" end |
#params ⇒ Object
11 12 13 |
# File 'lib/hs/elements/link.rb', line 11 def params super.merge(href: href) end |
#tag_name ⇒ Object
7 8 9 |
# File 'lib/hs/elements/link.rb', line 7 def tag_name 'a' end |