Class: WSDirector::Snapshot

Inherits:
Object
  • Object
show all
Defined in:
lib/wsdirector/snapshot.rb

Overview

Collect ws frame and dump them into a YAML file (or JSON)

Instance Method Summary collapse

Constructor Details

#initializeSnapshot

Returns a new instance of Snapshot.



6
7
8
9
# File 'lib/wsdirector/snapshot.rb', line 6

def initialize
  @steps = []
  @last_timestamp = nil
end

Instance Method Details

#<<(frame) ⇒ Object



11
12
13
14
# File 'lib/wsdirector/snapshot.rb', line 11

def <<(frame)
  record_gap!
  steps << {"send" => {"data" => frame}}
end

#to_jsonObject



20
21
22
# File 'lib/wsdirector/snapshot.rb', line 20

def to_json
  steps.to_json
end

#to_ymlObject



16
17
18
# File 'lib/wsdirector/snapshot.rb', line 16

def to_yml
  ::YAML.dump(steps)
end