Sha256: 4295d91e7dfbd458d463acd9b9b0db93c6487ab0f5a50593b4b853d31bd5059d
Contents?: true
Size: 592 Bytes
Versions: 1
Compression:
Stored size: 592 Bytes
Contents
require 'wurfl-lite-middleware/version' require 'wurfl-lite' class WURFL class Middleware def initialize( app, options = {} ) @app = app # Try to get the location from either parameters or environment location = options.delete(:wurfl_xml) || ENV['WURFL_XML'] @wurfl = location.nil? ? WURFL.new : WURFL.new( location ) # Configure the object @wurfl.match_threshold = options[:match_threshold] if options[:match_threshold] end def call( env ) env['WURFL'] = @wurfl[ env[ 'HTTP_USER_AGENT' ] ] @app.call( env ) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wurfl-lite-middleware-1.0.7 | lib/wurfl-lite-middleware.rb |