Sha256: 6d4fab6db58e0b3bb234602734ac4f3f6dc6981b20d64546e9f5ae92fb1ab378
Contents?: true
Size: 549 Bytes
Versions: 1
Compression:
Stored size: 549 Bytes
Contents
# frozen_string_literal: true require 'action_view' module ExternalLinkTo # rubocop:disable Style/Documentation include ActionView::Helpers::UrlHelper def external_link_to(*args, &block) name = block_given? ? capture(&block) : args.shift options = args.shift || {} html_options = args.shift || {} url = url_for(options) html_options[:rel] ||= 'noopener noreferrer' html_options[:target] ||= '_blank' link_to(name, url, html_options) end end ActiveSupport.on_load :action_view do include ExternalLinkTo end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
external_link_to-1.0.0 | lib/external_link_to/external_link_to.rb |