class Trombone::Cli

Public Instance Methods

list() click to toggle source
# File lib/trombone/cli.rb, line 17
def list
  Dir[File.expand_path("../sounds/*", __FILE__)].each { |sound| puts File.basename(sound, ".*") }
end
play(sound) click to toggle source
# File lib/trombone/cli.rb, line 6
def play(sound)
  file = File.expand_path("../sounds/#{sound}.mp3", __FILE__)
  if File.file?(file)
    pid = spawn("afplay #{file}")
    Process.detach(pid)
  else
    puts "Sound does not exist, use `list` command to see available sounds."
  end
end