Class: Morito::Processor::UserAgentPermission
- Inherits:
-
Object
- Object
- Morito::Processor::UserAgentPermission
- Defined in:
- lib/morito/processor.rb
Instance Method Summary collapse
- #allowed?(path) ⇒ Boolean
-
#initialize(user_agent, whole_permission) ⇒ UserAgentPermission
constructor
A new instance of UserAgentPermission.
Constructor Details
#initialize(user_agent, whole_permission) ⇒ UserAgentPermission
Returns a new instance of UserAgentPermission.
32 33 34 35 36 37 38 39 40 |
# File 'lib/morito/processor.rb', line 32 def initialize(user_agent, ) @user_agent = user_agent if [user_agent].empty? @permission = ['*'] else @permission = [user_agent] end end |
Instance Method Details
#allowed?(path) ⇒ Boolean
42 43 44 45 46 47 48 49 50 |
# File 'lib/morito/processor.rb', line 42 def allowed?(path) return true if disallow_unavailable? if !allow_unavailable? && regexp(:allow) =~ path true else regexp(:disallow) !~ path end end |