wurfl-lite-middleware 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,9 +3,15 @@ require 'wurfl-lite'
3
3
 
4
4
  class WURFL
5
5
  class Middleware
6
- def initialize( app )
6
+ def initialize( app, options = {} )
7
7
  @app = app
8
- @wurfl = ENV.has_key?( 'WURFL_XML' ) ? WURFL.new( ENV[ 'WURFL_XML' ].split(',') ) : WURFL.new
8
+
9
+ # Try to get the location from either parameters or environment
10
+ location = options.delete(:wurfl_xml) || ENV['WURFL_XML']
11
+ @wurfl = location.nil? ? WURFL.new : WURFL.new( location )
12
+
13
+ # Configure the object
14
+ @wurfl.match_threshold = options[:match_threshold] if options[:match_threshold]
9
15
  end
10
16
  def call( env )
11
17
  env['WURFL'] = @wurfl[ env[ 'HTTP_USER_AGENT' ] ]
@@ -1,5 +1,5 @@
1
1
  class WURFL
2
2
  class Middleware
3
- VERSION = "1.0.6"
3
+ VERSION = "1.0.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: wurfl-lite-middleware
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.6
5
+ version: 1.0.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Clive Crous
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-12-26 00:00:00 Z
13
+ date: 2012-06-19 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: wurfl-lite
@@ -86,7 +86,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- hash: -4285390585163492167
89
+ hash: -121990767
90
90
  segments:
91
91
  - 0
92
92
  version: "0"
@@ -95,14 +95,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
- hash: -4285390585163492167
98
+ hash: -121990767
99
99
  segments:
100
100
  - 0
101
101
  version: "0"
102
102
  requirements: []
103
103
 
104
104
  rubyforge_project:
105
- rubygems_version: 1.8.13
105
+ rubygems_version: 1.8.18
106
106
  signing_key:
107
107
  specification_version: 3
108
108
  summary: A Rack middleware implementation of wurfl-lite