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



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

def initialize(options={})
  @tty ||= options[:tty]
end

Instance Method Details

#blue!Object



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

def blue!
  write! 'sb'
end

#color!(color) ⇒ Object



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

def color!(color)
  write! color
end

#flash!Object



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

def flash!
  write! 'f'
end

#pulse!Object



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

def pulse!
  write! 'p'
end

#quit!Object



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

def quit!
  serial_port.flush
  serial_port.close
end

#rainbow!Object



28
29
30
# File 'lib/blinky_tape_test_status/base.rb', line 28

def rainbow!
  write! 'x'
end

#shutdown!Object



32
33
34
35
# File 'lib/blinky_tape_test_status/base.rb', line 32

def shutdown!
  blue!
  quit!
end

#solid!Object



37
38
39
# File 'lib/blinky_tape_test_status/base.rb', line 37

def solid!
  write! 's'
end

#test_sequence!Object



41
42
43
# File 'lib/blinky_tape_test_status/base.rb', line 41

def test_sequence!
  write! 't'
end

#write!(*commands) ⇒ Object



45
46
47
48
49
# File 'lib/blinky_tape_test_status/base.rb', line 45

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