« Return to Thread: i cant start webrick

Re: i cant start webrick

by James Britt-2 :: Rate this Message:

Reply to Author | View in Thread

spox wrote:

>
> s = HTTPServer.new(:Port => $port == 80 ? 80 : 801, :DocumentRoot => 'etc...')


Yikes!

Are people really so adverse to creating simple methods that describe
intent?  (They also make testing easier :) )

# Pick a name that makes sense if this is not a good one ...
def default_port default=801
  $port == 80 ? 80 : default
end

s = HTTPServer.new :Port => default_port, :DocumentRoot => 'etc...'





--
James Britt

www.jamesbritt.com           - Playing with Better Toys
www.ruby-doc.org             - Ruby Help & Documentation
www.rubystuff.com            - The Ruby Store for Ruby Stuff
www.neurogami.com            - Smart application development

 « Return to Thread: i cant start webrick