Class: Psych::Handlers::Recorder
- Inherits:
- 
      Psych::Handler
      
        - Object
- Psych::Handler
- Psych::Handlers::Recorder
 
- Defined in:
- lib/psych/handlers/recorder.rb
Overview
This handler will capture an event and record the event. Recorder events are available vial Psych::Handlers::Recorder#events.
For example:
recorder = Psych::Handlers::Recorder.new
parser = Psych::Parser.new recorder
parser.parse '--- foo'
recorder.events # => [list of events]
# Replay the events
emitter = Psych::Emitter.new $stdout
recorder.events.each do |m, args|
  emitter.send m, *args
end
Constant Summary
Constants inherited from Psych::Handler
Psych::Handler::EVENTS, Psych::Handler::OPTIONS
Instance Attribute Summary collapse
- 
  
    
      #events  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute events. 
Instance Method Summary collapse
- 
  
    
      #initialize  ⇒ Recorder 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Recorder. 
Methods inherited from Psych::Handler
#alias, #empty, #end_document, #end_mapping, #end_sequence, #end_stream, #scalar, #start_document, #start_mapping, #start_sequence, #start_stream, #streaming?
Constructor Details
#initialize ⇒ Recorder
Returns a new instance of Recorder.
| 27 28 29 30 | # File 'lib/psych/handlers/recorder.rb', line 27 def initialize @events = [] super end | 
Instance Attribute Details
#events ⇒ Object (readonly)
Returns the value of attribute events.
| 25 26 27 | # File 'lib/psych/handlers/recorder.rb', line 25 def events @events end |