Class: Nipper::Evidence
- Inherits:
-
Object
show all
- Defined in:
- lib/nipper/evidence.rb
Instance Method Summary
collapse
Constructor Details
#initialize(xml_node) ⇒ Evidence
Returns a new instance of Evidence.
3
4
5
|
# File 'lib/nipper/evidence.rb', line 3
def initialize(xml_node)
@xml = xml_node
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/nipper/evidence.rb', line 16
def method_missing(method, *args)
unless supported_tags.include?(method)
super
return
end
field = method.to_s.split('_')[1]
@xml.at_xpath('./device').attr(field)
end
|
Instance Method Details
#respond_to?(method, include_private = false) ⇒ Boolean
11
12
13
14
|
# File 'lib/nipper/evidence.rb', line 11
def respond_to?(method, include_private = false)
return true if supported_tags.include?(method.to_sym)
super
end
|
7
8
9
|
# File 'lib/nipper/evidence.rb', line 7
def supported_tags
[ :device_name, :device_osversion, :device_type ]
end
|