Class: UniversalAccessLogParser::ElementGroup::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/universal-access-log-parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.



38
39
40
# File 'lib/universal-access-log-parser.rb', line 38

def name
  @name
end

#parserObject (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

#regexpObject



40
41
42
43
# File 'lib/universal-access-log-parser.rb', line 40

def regexp
	return "(#{@nil_on}|#{@regexp})" if @nil_on
	"(#{@regexp})"
end