Module: Hanami::Helpers::LinkToHelper
- Includes:
- HtmlHelper
- Defined in:
- gems/gems/hanami-helpers-1.3.1/lib/hanami/helpers/link_to_helper.rb,
gems/gems/hanami-helpers-1.3.3/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.
Source: | on GitHub
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 |