Class: FlameChannelParser::FramecurveWriters::Base
- Inherits:
-
Object
- Object
- FlameChannelParser::FramecurveWriters::Base
- Defined in:
- lib/framecurve_writers/base.rb
Overview
Writes out a framecurve setup
Direct Known Subclasses
Defined Under Namespace
Classes: KeyWriter
Class Method Summary collapse
-
.extension ⇒ Object
Should return the desired extension for the exported file.
- .inherited(by) ⇒ Object
-
.with_each_writer ⇒ Object
Yields each defined writer class to the block.
Instance Method Summary collapse
-
#run_export(io) {|w| ... } ⇒ Object
Run the exporter writing the result to the passed IO.
-
#run_export_from_framecurve(io, curve) ⇒ Object
Run the exporter writing the result to it, and pulling framecurve frames from the passed Curve object.
Class Method Details
.extension ⇒ Object
Should return the desired extension for the exported file
26 27 28 |
# File 'lib/framecurve_writers/base.rb', line 26 def self.extension '.timewarp' end |
.inherited(by) ⇒ Object
15 16 17 18 |
# File 'lib/framecurve_writers/base.rb', line 15 def self.inherited(by) @@writers ||= [] @@writers.push(by) end |
.with_each_writer ⇒ Object
Yields each defined writer class to the block
21 22 23 |
# File 'lib/framecurve_writers/base.rb', line 21 def self.with_each_writer @@writers.each(&Proc.new) end |
Instance Method Details
#run_export(io) {|w| ... } ⇒ Object
Run the exporter writing the result to the passed IO. Will yield a KeyWriter to the caller for writing frames (call key(at, value) on it)
32 33 34 35 36 37 38 |
# File 'lib/framecurve_writers/base.rb', line 32 def run_export(io) w = KeyWriter.new yield(w) w.keys.each do | at, value | io.puts("%d %.5f" % [at, value]) end end |
#run_export_from_framecurve(io, curve) ⇒ Object
Run the exporter writing the result to it, and pulling framecurve frames from the passed Curve object
42 43 44 45 46 47 48 |
# File 'lib/framecurve_writers/base.rb', line 42 def run_export_from_framecurve(io, curve) run_export(io) do | writer | curve.to_materialized_curve.each_tuple do | t | writer.key(t.at, t.value) end end end |