Skip to content

Commit

Permalink
Allow passing port as a string in Server.new
Browse files Browse the repository at this point in the history
  • Loading branch information
macournoyer committed Apr 18, 2008
1 parent b02c717 commit c90f50f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
== 0.8.1 Rebel Porpoise release
* Allow passing port as a string in Server.new
* Define deferred?(env) in your Rack application to set if a request is handled in a
thread (return true) or not (return false).

Expand Down
6 changes: 3 additions & 3 deletions lib/thin/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ def initialize(*args, &block)

args.each do |arg|
case arg
when String then host = arg
when Fixnum then port = arg
when Hash then options = arg
when Fixnum, /^\d+$/ then port = arg.to_i
when String then host = arg
when Hash then options = arg
else
@app = arg if arg.respond_to?(:call)
end
Expand Down
8 changes: 8 additions & 0 deletions spec/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@
server.backend.should be_kind_of(Thin::Backends::SwiftiplyClient)
end

it "should set port as string" do
app = proc {}
server = Server.new('192.168.1.1', '8080')

server.host.should == '192.168.1.1'
server.port.should == 8080
end

it "should not register signals w/ :signals => false" do
Server.should_not_receive(:setup_signals)
Server.new(:signals => false)
Expand Down

0 comments on commit c90f50f

Please sign in to comment.