Module: Saxxy::Callbacks::SAX
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(context) ⇒ Object
- #on_characters(string) ⇒ Object
- #on_end_document ⇒ Object
- #on_end_element(name) ⇒ Object
- #on_start_element(name, attrs = {}) ⇒ Object
Class Method Details
.included(base) ⇒ Object
10 11 12 13 14 |
# File 'lib/saxxy/callbacks/sax.rb', line 10 def self.included(base) base.extend Forwardable base.def_delegators :@event_registry, :activate_events_on, :deactivate_events_on, :push_text, :register_event_from_action, :remove_actions! end |
Instance Method Details
#initialize(context) ⇒ Object
16 17 18 19 |
# File 'lib/saxxy/callbacks/sax.rb', line 16 def initialize(context) initialize_state @active_pool << context end |
#on_characters(string) ⇒ Object
26 27 28 |
# File 'lib/saxxy/callbacks/sax.rb', line 26 def on_characters(string) push_text(string || "") end |
#on_end_document ⇒ Object
35 36 37 38 39 |
# File 'lib/saxxy/callbacks/sax.rb', line 35 def on_end_document @active_pool.clear @inactive_pool.clear @event_registry.clear end |
#on_end_element(name) ⇒ Object
30 31 32 33 |
# File 'lib/saxxy/callbacks/sax.rb', line 30 def on_end_element(name) deactivate_events_on(name) deactivate_contexts_on(name) end |
#on_start_element(name, attrs = {}) ⇒ Object
21 22 23 24 |
# File 'lib/saxxy/callbacks/sax.rb', line 21 def on_start_element(name, attrs = {}) register_and_activate_events_on(name, attrs) activate_contexts_on(name, attrs) end |