Class: Hobelar::Parsers::GetFilter

Inherits:
Hobelar::Parsers
  • Object
show all
Defined in:
lib/hobelar/parsers/getfilter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Hobelar::Parsers

#attr_value, #characters

Constructor Details

#initializeGetFilter

Returns a new instance of GetFilter.



7
8
9
10
# File 'lib/hobelar/parsers/getfilter.rb', line 7

def initialize
  super
  @response[:rules] = []
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



5
6
7
# File 'lib/hobelar/parsers/getfilter.rb', line 5

def response
  @response
end

Instance Method Details

#end_element(name) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/hobelar/parsers/getfilter.rb', line 25

def end_element(name)
  case name
  when "filterset"
    @in_fset = false
  when "rule"
    @response[:rules] << {:type => @type, :module => @module, :metric => @metric}
  end
end

#start_element(name, attrs = []) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/hobelar/parsers/getfilter.rb', line 12

def start_element(name, attrs = [])
  super

  case name
  when "filterset"
    @in_fset = true
  when "rule"
    @type = attr_value("type", attrs)
    @module = attr_value("module", attrs)
    @metric = attr_value("metric", attrs)
  end
end