Method: YARD::Templates::Helpers::HtmlHelper#link_url

Defined in:
lib/yard/templates/helpers/html_helper.rb

Links to a URL

Parameters:

  • url (String)

    the URL to link to

  • title (String) (defaults to: nil)

    the optional title to display the link as

  • params (Hash) (defaults to: {})

    optional parameters for the link

Returns:


264
265
266
267
268
269
270
271
272
273
# File 'lib/yard/templates/helpers/html_helper.rb', line 264

def link_url(url, title = nil, params = {})
  title ||= url
  title.gsub!(/[\r\n]/, ' ')
  params = SymbolHash.new(false).update(
    :href => url,
    :title  => h(title)
  ).update(params)
  params[:target] ||= '_parent' if url =~ /^(\w+):\/\//
  "<a #{tag_attrs(params)}>#{title}</a>".gsub(/[\r\n]/, ' ')
end