Class: Evergreen::IDL::IDLSaxHandler
- Inherits:
-
Object
- Object
- Evergreen::IDL::IDLSaxHandler
- Includes:
- REXML::SAX2Listener
- Defined in:
- lib/evergreen/idl.rb
Overview
A SAX parsing handler
Instance Attribute Summary collapse
-
#idl_fields ⇒ Object
readonly
Returns the value of attribute idl_fields.
Instance Method Summary collapse
-
#initialize ⇒ IDLSaxHandler
constructor
A new instance of IDLSaxHandler.
-
#start_element(_uri, _localname, _qname, attributes) ⇒ Object
Callback for when we hit an XML attribute.
Constructor Details
#initialize ⇒ IDLSaxHandler
Returns a new instance of IDLSaxHandler.
52 53 54 55 56 |
# File 'lib/evergreen/idl.rb', line 52 def initialize @idl_fields = {} @current_class = nil super end |
Instance Attribute Details
#idl_fields ⇒ Object (readonly)
Returns the value of attribute idl_fields.
50 51 52 |
# File 'lib/evergreen/idl.rb', line 50 def idl_fields @idl_fields end |
Instance Method Details
#start_element(_uri, _localname, _qname, attributes) ⇒ Object
Callback for when we hit an XML attribute
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/evergreen/idl.rb', line 59 def start_element(_uri, _localname, _qname, attributes) if attributes.key? 'id' # We found a class ID! @current_class = attributes['id'] @idl_fields[@current_class] = [] elsif attributes.key? 'name' # We found the name of a field! @idl_fields[@current_class].push(attributes['name']) end end |