Module: Rack::Dedos
- Defined in:
- lib/rack/dedos.rb,
lib/rack/dedos/cache.rb,
lib/rack/dedos/version.rb,
lib/rack/dedos/filters/base.rb,
lib/rack/dedos/filters/country.rb,
lib/rack/dedos/filters/user_agent.rb
Defined Under Namespace
Modules: Filters
Classes: Cache
Constant Summary
collapse
- VERSION =
"0.2.0"
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
14
15
16
|
# File 'lib/rack/dedos.rb', line 14
def config
@config ||= {}
end
|
.new(app, options = {}) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/rack/dedos.rb', line 18
def new(app, options = {})
except = Array options[:except]
Rack::Builder.new do
unless except.include? :user_agent
require_relative 'dedos/filter/user_agent'
use(::Rack::Dedos::Filters::UserAgent, options)
end
unless except.include? :country
require_relative 'dedos/filter/country'
use(::Rack::Dedos::Filters::Country, options)
end
run app
end.to_app
end
|