Class: Eg::Music::Realtime

Inherits:
Fit::TimedActionFixture show all
Defined in:
lib/eg/music/realtime.rb

Constant Summary

Constants inherited from Fit::Fixture

Fit::Fixture::GRAY, Fit::Fixture::GREEN, Fit::Fixture::RED, Fit::Fixture::YELLOW

Instance Attribute Summary

Attributes inherited from Fit::TimedActionFixture

#format

Attributes inherited from Fit::Fixture

#args, #counts, #listener, #summary

Instance Method Summary collapse

Methods inherited from Fit::TimedActionFixture

#do_cells, #do_table, #td

Methods inherited from Fit::ActionFixture

actor, actor=, #check, #do_cells, #start

Methods inherited from Fit::Fixture

camel, #check, #do_cell, #do_cells, #do_row, #do_rows, #do_table, #do_tables, #error, escape, #exception, #find_class, #fixture_name, #get_args_for_table, #get_linked_fixture_with_args, gray, #ignore, #info, #interpret_following_tables, #interpret_tables, label, metadata, #parse, #right, #total_errors, #totals, #wrong

Constructor Details

#initializeRealtime

Returns a new instance of Realtime.



11
12
13
14
15
# File 'lib/eg/music/realtime.rb', line 11

def initialize
  super
  @system = Simulator.system
  @system.reset
end

Instance Method Details

#awaitObject



18
# File 'lib/eg/music/realtime.rb', line 18

def await; system('wait', cells.more); end

#enterObject



20
21
22
23
# File 'lib/eg/music/realtime.rb', line 20

def enter
  @system.delay 0.8
  super
end

#failObject



19
# File 'lib/eg/music/realtime.rb', line 19

def fail; system('fail', cells.more); end

#pauseObject



17
# File 'lib/eg/music/realtime.rb', line 17

def pause; @system.delay(cells.more.text.to_f); end

#pressObject



24
25
26
27
# File 'lib/eg/music/realtime.rb', line 24

def press
  @system.delay 1.2
  super
end

#system(prefix, cell) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/eg/music/realtime.rb', line 28

def system prefix, cell
  method_name = Fit::Fixture.camel "#{prefix} #{cell.text}"
  begin
    @system.send(method_name)
  rescue Exception => e
    exception cell, e
  end
end

#timeObject



16
# File 'lib/eg/music/realtime.rb', line 16

def time; Time.at(Simulator.time); end