Class: PackageManager::ParseXML

Inherits:
Object
  • Object
show all
Includes:
MergeObservable
Defined in:
lib/JRubyR/package.rb

Overview

Class to parse the maven-metadata.xml file for package management

Instance Method Summary collapse

Methods included from MergeObservable

#add_new_observer, #merge_observers, #notify_observers, #old_notify

Constructor Details

#initialize(source) ⇒ ParseXML


Parse the input_file and send parsed events to the given state machine. Results should be stored in the output_dir




76
77
78
# File 'lib/JRubyR/package.rb', line 76

def initialize(source)
  @source = source
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object


This method is necessary do ignore parsing events that are of no interest to our parsing.




94
95
96
# File 'lib/JRubyR/package.rb', line 94

def method_missing(*args)
  # p args
end

Instance Method Details

#startObject


start parsing the file. This class will receive the events and redirect them to listeners




85
86
87
# File 'lib/JRubyR/package.rb', line 85

def start
  REXML::Document.parse_stream(@source, self)
end

#tag_end(name) ⇒ Object


Called when receiving a tag_end event




111
112
113
114
# File 'lib/JRubyR/package.rb', line 111

def tag_end(name)
  changed
  notify_observers(:tag_end, name, nil)
end

#tag_start(name, attrs) ⇒ Object


Called when receiving a tag_start event




102
103
104
105
# File 'lib/JRubyR/package.rb', line 102

def tag_start(name, attrs)
  changed
  notify_observers(:tag_start, name, attrs)
end

#text(text) ⇒ Object





120
121
122
123
# File 'lib/JRubyR/package.rb', line 120

def text(text)
  changed
  notify_observers(:new_text, text, nil)
end