Class: UniversalAccessLogParser::ElementGroup::Root

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

Instance Attribute Summary collapse

Attributes inherited from Integrating

#separator

Instance Method Summary collapse

Methods inherited from UniversalAccessLogParser::ElementGroup

#date, #date_iis, #date_ncsa, #double_quoted, #element, #float, #integer, #integratin_group, #ip, #optional, parser, #separated_with, #separator, #single_quoted, #string, #surrounded_by, #surrounding_group

Constructor Details

#initialize(separator, &block) ⇒ Root

Returns a new instance of Root.



56
57
58
59
# File 'lib/universal-access-log-parser.rb', line 56

def initialize(separator, &block)
	@skip_lines = []
	super(nil, separator, &block)
end

Instance Attribute Details

#skip_linesObject (readonly)

Returns the value of attribute skip_lines.



61
62
63
# File 'lib/universal-access-log-parser.rb', line 61

def skip_lines
  @skip_lines
end

Instance Method Details

#namesObject



67
68
69
# File 'lib/universal-access-log-parser.rb', line 67

def names
	super << :other
end

#parsersObject



71
72
73
74
75
76
# File 'lib/universal-access-log-parser.rb', line 71

def parsers
	super << lambda{ |s|
		return nil if s.empty?
		s.sub(Regexp.new("^#{separator}"), '')
	}
end

#regexpObject



63
64
65
# File 'lib/universal-access-log-parser.rb', line 63

def regexp
	super + "(|#{separator}.*)"
end

#skip_line(regexp) ⇒ Object

root specific DSL



79
80
81
# File 'lib/universal-access-log-parser.rb', line 79

def skip_line(regexp)
	@skip_lines << regexp
end