Class: Saint::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/saint/base.rb

Direct Known Subclasses

Evidence, Vulnerability

Instance Method Summary collapse

Constructor Details

#initialize(xml_node) ⇒ Base

Returns a new instance of Base.



3
4
5
# File 'lib/saint/base.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
# File 'lib/saint/base.rb', line 16

def method_missing(method, *args)
  unless supported_tags.include?(method)
    super
    return
  end

  return process_field_value(method)
end

Instance Method Details

#process_field_value(method) ⇒ Object



25
26
27
# File 'lib/saint/base.rb', line 25

def process_field_value(method)
  raise "Method #process_field_value not overridden!"
end

#respond_to?(method, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/saint/base.rb', line 11

def respond_to?(method, include_private=false)
  return true if supported_tags.include?(method.to_sym)
  super
end

#supported_tagsObject



7
8
9
# File 'lib/saint/base.rb', line 7

def supported_tags
  []
end