Class: Spinny::Connection
- Inherits:
-
Object
- Object
- Spinny::Connection
- Defined in:
- lib/spinny/connection.rb
Instance Method Summary collapse
-
#initialize(port = Server::DEFAULT_PORT) ⇒ Connection
constructor
A new instance of Connection.
- #push(code) ⇒ Object
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 |