Class: Sanic

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

Class Method Summary collapse

Class Method Details

.playObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/sanic.rb', line 4

def self.play
  song = File.expand_path('../sanic.mp3', __FILE__)
   = File.expand_path('../sanic.txt', __FILE__)
  os = Launchy::Application.new.host_os_family.host_os
  puts
  File.open().each_line { |line| puts line }
  case os
  when /windows/
    `start #{ song }`
  when /darwin/
    `afplay #{ song }`
  when /nix/
    `aplay #{ song }`
  when /linux/
    `mpg321 -q #{ song }`
  when /cygwin/
    `cygstart #{ song }`
  end
end