Sha256: 7f0c6681f178c51c4ea2bb7659cd98f7f505c47d95f28eb9a5c3f57227665a10

Contents?: true

Size: 519 Bytes

Versions: 1

Compression:

Stored size: 519 Bytes

Contents

require 'referer-parser'

module RefererParser
  module Rails
    module Request
      def search_term
        self.referer_parser.present? ? self.referer_parser.search_term : nil
      end

      def search_engine
        self.referer_parser.present? ? self.referer_parser.referer : nil
      end

    protected
      
      def referer_parser
        return @referer_parser if defined?(@referer_parser)
        @referer_parser = referer.present? ? RefererParser::Referer.new(referer) : nil
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
referer-parser-rails-1.0.2 lib/referer-parser/request.rb