Class: UniversalAccessLogParser::ElementGroup::Element
- Inherits:
-
Object
- Object
- UniversalAccessLogParser::ElementGroup::Element
- Defined in:
- lib/universal-access-log-parser.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
Instance Method Summary collapse
-
#initialize(name, regexp, nil_on = nil) ⇒ Element
constructor
A new instance of Element.
- #regexp ⇒ Object
Constructor Details
#initialize(name, regexp, nil_on = nil) ⇒ Element
Returns a new instance of Element.
28 29 30 31 32 33 34 35 36 |
# File 'lib/universal-access-log-parser.rb', line 28 def initialize(name, regexp, nil_on = nil) @name = name @regexp = regexp @nil_on = nil_on @parser = lambda{|s| return nil if @nil_on and s == @nil_on yield s if block_given? } end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
38 39 40 |
# File 'lib/universal-access-log-parser.rb', line 38 def name @name end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
38 39 40 |
# File 'lib/universal-access-log-parser.rb', line 38 def parser @parser end |
Instance Method Details
#regexp ⇒ Object
40 41 42 43 |
# File 'lib/universal-access-log-parser.rb', line 40 def regexp return "(#{@nil_on}|#{@regexp})" if @nil_on "(#{@regexp})" end |