Class: Morito::Processor::LineParser
- Inherits:
-
Object
- Object
- Morito::Processor::LineParser
- Defined in:
- lib/morito/processor.rb
Instance Attribute Summary collapse
-
#disallow ⇒ Object
readonly
Returns the value of attribute disallow.
-
#user_agent ⇒ Object
readonly
Returns the value of attribute user_agent.
Instance Method Summary collapse
Instance Attribute Details
#disallow ⇒ Object (readonly)
Returns the value of attribute disallow.
44 45 46 |
# File 'lib/morito/processor.rb', line 44 def disallow @disallow end |
#user_agent ⇒ Object (readonly)
Returns the value of attribute user_agent.
44 45 46 |
# File 'lib/morito/processor.rb', line 44 def user_agent @user_agent end |
Instance Method Details
#disallow? ⇒ Boolean
58 59 60 |
# File 'lib/morito/processor.rb', line 58 def disallow? @user_agent && @disallow end |
#parse(line) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/morito/processor.rb', line 46 def parse(line) case line when /\AUser-agent:\s+(.+?)\s*(?:#.+)?\z/i @user_agent = $1 @disallow = nil when /\ADisallow:\s+(.+?)\s*(?:#.+)?\z/i @disallow = $1 else @disallow = nil end end |