Module: HarlemBits

Defined in:
lib/harlem_bits.rb,
lib/harlem_bits/bit.rb,
lib/harlem_bits/arena.rb,
lib/harlem_bits/harlem.rb,
lib/harlem_bits/version.rb,
lib/harlem_bits/cli_rendering.rb

Defined Under Namespace

Modules: CliRendering Classes: Arena, Bit, Harlem

Constant Summary collapse

DURATION =
30
FRAME_RATE =
30.0
AUDIO_FILE =
'bin/HarlemShake.mp3'
VERSION =
"0.0.5"

Class Method Summary collapse

Class Method Details

.shake(width, height) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/harlem_bits.rb', line 13

def self.shake(width, height)
  if OS.osx?
    t = Thread.new { system "afplay #{AUDIO_FILE}" }
  elsif OS.linux?
    t = Thread.new { system "mpg123 #{AUDIO_FILE}" }
  else
    # Playing songs from windows command line? Can it be done? Has science gone too far?
    t = Thread.new { puts "Pretend that there's music, pal." }
  end
  s = Harlem.new width || 50, height || 25
  s.start
rescue Interrupt
  s.kill
  t.kill
ensure
  puts 'fin'
  exit 0
end