Sha256: d45e42fced892a38186ad8cd953522a46e908bdad2e0633e05063c67cc11cc7f
Contents?: true
Size: 484 Bytes
Versions: 1
Compression:
Stored size: 484 Bytes
Contents
# frozen_string_literal: true module ExternalLinkTo # rubocop:disable Style/Documentation 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-0.1.0 | lib/external_link_to/external_link_to.rb |