Class: Spielbash::Movie

Inherits:
Object
  • Object
show all
Defined in:
lib/spielbash/model/movie.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, pre_run_actions, actions, post_run_actions, context, output_path) ⇒ Movie

Returns a new instance of Movie.



5
6
7
8
9
10
11
12
# File 'lib/spielbash/model/movie.rb', line 5

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

Instance Attribute Details

#actionsObject

Returns the value of attribute actions.



3
4
5
# File 'lib/spielbash/model/movie.rb', line 3

def actions
  @actions
end

#contextObject

Returns the value of attribute context.



3
4
5
# File 'lib/spielbash/model/movie.rb', line 3

def context
  @context
end

#output_pathObject

Returns the value of attribute output_path.



3
4
5
# File 'lib/spielbash/model/movie.rb', line 3

def output_path
  @output_path
end

#post_run_actionsObject

Returns the value of attribute post_run_actions.



3
4
5
# File 'lib/spielbash/model/movie.rb', line 3

def post_run_actions
  @post_run_actions
end

#pre_run_actionsObject

Returns the value of attribute pre_run_actions.



3
4
5
# File 'lib/spielbash/model/movie.rb', line 3

def pre_run_actions
  @pre_run_actions
end

#sessionObject

Returns the value of attribute session.



3
4
5
# File 'lib/spielbash/model/movie.rb', line 3

def session
  @session
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/spielbash/model/movie.rb', line 3

def title
  @title
end

Instance Method Details

#interruptObject



38
39
40
# File 'lib/spielbash/model/movie.rb', line 38

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

#shootObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/spielbash/model/movie.rb', line 14

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