Class: BlinkyTapeTestStatus::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/blinky_tape_test_status/base.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Base

Returns a new instance of Base.



3
4
5
6
# File 'lib/blinky_tape_test_status/base.rb', line 3

def initialize(options={})
  @tty ||= options[:tty] || best_guess_tty
  raise "No tty specified or discoved" unless @tty
end

Instance Method Details

#blue!Object



8
9
10
# File 'lib/blinky_tape_test_status/base.rb', line 8

def blue!
  write! 'sb'
end

#color!(color) ⇒ Object



12
13
14
# File 'lib/blinky_tape_test_status/base.rb', line 12

def color!(color)
  write! color
end

#flash!Object



16
17
18
# File 'lib/blinky_tape_test_status/base.rb', line 16

def flash!
  write! 'f'
end

#pulse!Object



20
21
22
# File 'lib/blinky_tape_test_status/base.rb', line 20

def pulse!
  write! 'p'
end

#quit!Object



24
25
26
27
28
# File 'lib/blinky_tape_test_status/base.rb', line 24

def quit!
  serial_port.flush
  serial_port.close
  @serial_port = nil
end

#rainbow!Object



30
31
32
# File 'lib/blinky_tape_test_status/base.rb', line 30

def rainbow!
  write! 'x'
end

#shutdown!Object



34
35
36
37
# File 'lib/blinky_tape_test_status/base.rb', line 34

def shutdown!
  blue!
  quit!
end

#solid!Object



39
40
41
# File 'lib/blinky_tape_test_status/base.rb', line 39

def solid!
  write! 's'
end

#test_sequence!Object



43
44
45
# File 'lib/blinky_tape_test_status/base.rb', line 43

def test_sequence!
  write! 't'
end

#write!(*commands) ⇒ Object



47
48
49
50
51
52
# File 'lib/blinky_tape_test_status/base.rb', line 47

def write!(*commands)
  commands.each do |command|
    serial_port.puts command
  end
  quit!
end