lib/rails_rinku.rb
require 'rinku' module RailsRinku class Railtie < ::Rails::Railtie initializer 'rails_rinku' do |app| ActiveSupport.on_load(:action_view) do require 'active_support/core_ext/object/blank' require 'active_support/core_ext/array/extract_options' require 'active_support/core_ext/hash/reverse_merge' require 'active_support/core_ext/hash/keys' module ::ActionView module Helpers # :nodoc: module TextHelper def auto_link(text, *args, &block) return ''.html_safe if text.blank? options = args.size == 2 ? {} : args.extract_options! unless args.empty? options[:link] = args[0] || :all options[:html] = args[1] || {} end options.reverse_merge!(:link => :all, :html => {}) text = sanitize(text) unless options[:sanitize] == false Rinku.auto_link(text, options[:link], tag_options(options[:html]), &block) end end end end end end end end