Class: WSDirector::Snapshot
- Inherits:
-
Object
- Object
- WSDirector::Snapshot
- Defined in:
- lib/wsdirector/snapshot.rb
Overview
Collect ws frame and dump them into a YAML file (or JSON)
Instance Method Summary collapse
- #<<(frame) ⇒ Object
-
#initialize ⇒ Snapshot
constructor
A new instance of Snapshot.
- #to_json ⇒ Object
- #to_yml ⇒ Object
Constructor Details
#initialize ⇒ Snapshot
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_json ⇒ Object
20 21 22 |
# File 'lib/wsdirector/snapshot.rb', line 20 def to_json steps.to_json end |
#to_yml ⇒ Object
16 17 18 |
# File 'lib/wsdirector/snapshot.rb', line 16 def to_yml ::YAML.dump(steps) end |