class Send2MacClient::Listener
Public Class Methods
new()
click to toggle source
# File lib/send2mac/listener.rb, line 7 def initialize @agent = Mechanize.new end
Public Instance Methods
listen()
click to toggle source
# File lib/send2mac/listener.rb, line 11 def listen puts "Listening..." loop do url = @agent.get("http://send2mac.com/get.php?APIKey=#{$api_key}").parser.xpath("//html/body/p").text unless (url =~ /\/\//).nil? url = url.gsub(/\r/,"") url = url.gsub(/\n/,"") puts url Launchy.open url.to_s else sleep 2 end end end