Sha256: f14796a83e79ad7cdea33e9d3786fae676581de6a7c8eab0a925e9e14cba4361

Contents?: true

Size: 461 Bytes

Versions: 6

Compression:

Stored size: 461 Bytes

Contents

module StaticMatic
  module Helpers
    module UrlHelper
      def link_to(name, options = {}, html_options = nil)
        options = urlify(name) if options == {}
        super(name, options, html_options)
      end
    
      def urlify(string)
        string.tr(" ", "_").
               sub("&", "and").
               sub("@", "at").
               tr("^A-Za-z0-9_", "").
               sub(/_{2,}/, "_").
               downcase
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tdreyno-staticmatic-2.0.3 lib/staticmatic/helpers/url_helper.rb
tdreyno-staticmatic-2.1.0 lib/staticmatic/helpers/url_helper.rb
tdreyno-staticmatic-2.1.1 lib/staticmatic/helpers/url_helper.rb
tdreyno-staticmatic-2.1.3 lib/staticmatic/helpers/url_helper.rb
tdreyno-staticmatic-2.1.4 lib/staticmatic/helpers/url_helper.rb
tdreyno-staticmatic-2.9.0 lib/staticmatic/helpers/url_helper.rb