Sha256: 057e52b5cbdbdf2459993af21deee93d3ad2f907629477f75ef551a7dd62171d

Contents?: true

Size: 1023 Bytes

Versions: 3

Compression:

Stored size: 1023 Bytes

Contents

module Spielbash
  class Movie
    attr_accessor :title, :pre_run_actions, :actions, :post_run_actions, :context, :output_path, :session

    def initialize(title, pre_run_actions, actions, post_run_actions, context, output_path)
      @title = title
      @pre_run_actions = pre_run_actions
      @actions = actions
      @post_run_actions = post_run_actions
      @context = context
      @output_path = output_path
    end

    def shoot
      session = Spielbash::Session.new(title.downcase.split.join('_'), output_path, context)
      session.new_session

      pre_run_actions.each do |action|
        action.execute(session)
      end

      session.start_recording

      actions.each do |action|
        action.execute(session)
      end

      session.stop_recording

      post_run_actions.each do |action|
        action.execute(session)
      end

      session.close_session
    end

    def interrupt
      Spielbash::PressKeyAction.new('C-c', context).execute(session) unless session.nil?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spielbash-0.1.4 lib/spielbash/model/movie.rb
spielbash-0.1.3 lib/spielbash/model/movie.rb
spielbash-0.1.2 lib/spielbash/model/movie.rb