Sha256: f9d617454b822c05bf798b7e264d26877e9a448976b52659e0606fc42717a6e1

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

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.stop_recording
      session.close_session
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spielbash-0.1.1 lib/spielbash/model/movie.rb
spielbash-0.1.0 lib/spielbash/model/movie.rb