Class: Spinny::Connection

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

Instance Method Summary collapse

Constructor Details

#initialize(port = Server::DEFAULT_PORT) ⇒ Connection

Returns a new instance of Connection.



6
7
8
# File 'lib/spinny/connection.rb', line 6

def initialize(port = Server::DEFAULT_PORT)
  @port = port
end

Instance Method Details

#push(code) ⇒ Object



10
11
12
13
14
# File 'lib/spinny/connection.rb', line 10

def push(code)
  # connect to port, send code over port
  uri = URI("http://localhost:#{@port}/enqueue")
  Net::HTTP.post_form(uri, "code" => code)
end