Module: Hanami::Helpers::LinkToHelper
- Includes:
- HtmlHelper
- Defined in:
- lib/hanami/helpers/link_to_helper.rb
Overview
LinkTo Helper
Including Hanami::Helpers::LinkTo
will include the link_to
public method.
This helper can be used both in views and templates.
Instance Method Summary collapse
-
#link_to(content, url = nil, options = {}, &blk) ⇒ String
Generates an anchor tag for the given arguments.
Instance Method Details
#link_to(content, url, options) ⇒ String #link_to(url, options, &blk) ⇒ String
Generates an anchor tag for the given arguments.
Contents are automatically escaped.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/hanami/helpers/link_to_helper.rb', line 118 def link_to(content, url = nil, = {}, &blk) # rubocop:disable Metrics/MethodLength if block_given? = url || {} url = content content = nil end begin [:href] = url or raise ArgumentError rescue TypeError raise ArgumentError end html.a(blk || content, ) end |