Class: Morito::Processor::LineParser
- Inherits:
-
Object
- Object
- Morito::Processor::LineParser
- Defined in:
- lib/morito/processor.rb
Instance Attribute Summary collapse
-
#allow ⇒ Object
readonly
Returns the value of attribute allow.
-
#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
#allow ⇒ Object (readonly)
Returns the value of attribute allow.
72 73 74 |
# File 'lib/morito/processor.rb', line 72 def allow @allow end |
#disallow ⇒ Object (readonly)
Returns the value of attribute disallow.
72 73 74 |
# File 'lib/morito/processor.rb', line 72 def disallow @disallow end |
#user_agent ⇒ Object (readonly)
Returns the value of attribute user_agent.
72 73 74 |
# File 'lib/morito/processor.rb', line 72 def user_agent @user_agent end |
Instance Method Details
#allow? ⇒ Boolean
87 88 89 |
# File 'lib/morito/processor.rb', line 87 def allow? @user_agent && @allow end |
#disallow? ⇒ Boolean
91 92 93 |
# File 'lib/morito/processor.rb', line 91 def disallow? @user_agent && @disallow end |
#parse(line) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/morito/processor.rb', line 74 def parse(line) case line when /\AUser-agent:\s+(.+?)\s*(?:#.+)?\z/i @user_agent = $1 when /\ADisallow:\s+(.+?)\s*(?:#.+)?\z/i @disallow = $1 when /\AAllow:\s+(.+?)\s*(?:#.+)?\z/i @allow = $1 end end |