summaryrefslogtreecommitdiff
path: root/lib/psych/handler.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-10-28 18:24:15 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2012-10-28 18:24:15 -0700
commitc37649bad07e60fb6fbbb4bd78147eff70bd9e3a (patch)
tree99c3e480df716b0cbfeaf571ca2e4257aa50bb66 /lib/psych/handler.rb
parent1f4812fd517373cb827ba284a2e18112539046fb (diff)
downloadpsych-c37649bad07e60fb6fbbb4bd78147eff70bd9e3a.tar.gz
* ext/psych/lib/psych/handlers/recorder.rb: added a class for
recording YAML parse and emit events. * ext/psych/lib/psych/handler.rb: adding a list of events so that handler classes can more easily be meta-programmed. * test/psych/handlers/test_recorder.rb: tests for the change.
Diffstat (limited to 'lib/psych/handler.rb')
-rw-r--r--lib/psych/handler.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/psych/handler.rb b/lib/psych/handler.rb
index d3b9963..c55afe7 100644
--- a/lib/psych/handler.rb
+++ b/lib/psych/handler.rb
@@ -25,6 +25,19 @@ module Psych
# Default dumping options
OPTIONS = DumperOptions.new
+ # Events that a Handler should respond to.
+ EVENTS = [ :alias,
+ :empty,
+ :end_document,
+ :end_mapping,
+ :end_sequence,
+ :end_stream,
+ :scalar,
+ :start_document,
+ :start_mapping,
+ :start_sequence,
+ :start_stream ]
+
###
# Called with +encoding+ when the YAML stream starts. This method is
# called once per stream. A stream may contain multiple documents.