Class: WhirledPeas::Command::Record

Inherits:
ConfigCommand
  • Object
show all
Defined in:
lib/whirled_peas/command/record.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.descriptionObject



6
7
8
# File 'lib/whirled_peas/command/record.rb', line 6

def self.description
  'Record animation to a file'
end

Instance Method Details

#startObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/whirled_peas/command/record.rb', line 10

def start
  super
  require 'highline'
  require 'whirled_peas/animator/renderer_consumer'
  require 'whirled_peas/animator/producer'
  require 'whirled_peas/device/output_file'

  width, height = HighLine.new.terminal.terminal_size
  consumer = Animator::RendererConsumer.new(
    WhirledPeas.config.template_factory,
    Device::OutputFile.new(out_file),
    width,
    height
  )
  Animator::Producer.produce(consumer) do |producer|
    config.application.start(producer)
  end
end