Class: UniversalAccessLogParser::ElementGroup::Optional
Instance Method Summary
collapse
#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(parent, name, options = {}, &block) ⇒ Optional
Returns a new instance of Optional.
97
98
99
100
101
|
# File 'lib/universal-access-log-parser.rb', line 97
def initialize(parent, name, options = {}, &block)
@group_name = name
@nil_on = options[:nil_on]
super(parent, &block)
end
|
Instance Method Details
#names ⇒ Object
107
108
109
|
# File 'lib/universal-access-log-parser.rb', line 107
def names
super.unshift @group_name
end
|
#parsers ⇒ Object
111
112
113
114
115
116
117
|
# File 'lib/universal-access-log-parser.rb', line 111
def parsers
if @nil_on
super.unshift lambda{ |s| s == @nil_on ? nil : s }
else
super.unshift lambda{ |s| s}
end
end
|
#regexp ⇒ Object
103
104
105
|
# File 'lib/universal-access-log-parser.rb', line 103
def regexp
'(' + super + '|.*?)'
end
|