From aaf6e38fcedad021c2052d572592adaa7d69f584 Mon Sep 17 00:00:00 2001 From: Kevin Clark Date: Wed, 18 Jun 2008 00:51:06 +0000 Subject: [PATCH] Style tweaks git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@668895 13f79535-47bb-0310-9956-ffa450edef68 --- lib/rb/lib/thrift/server/thttpserver.rb | 6 +++--- lib/rb/lib/thrift/transport/thttpclient.rb | 6 +++--- lib/rb/lib/thrift/transport/ttransport.rb | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/rb/lib/thrift/server/thttpserver.rb b/lib/rb/lib/thrift/server/thttpserver.rb index 7dce2182..e7206403 100644 --- a/lib/rb/lib/thrift/server/thttpserver.rb +++ b/lib/rb/lib/thrift/server/thttpserver.rb @@ -9,12 +9,12 @@ require 'mongrel' ## Sticks a service on a URL, using mongrel to do the HTTP work class TSimpleMongrelHTTPServer class Handler < Mongrel::HttpHandler - def initialize processor, protocol_factory + def initialize(processor, protocol_factory) @processor = processor @protocol_factory = protocol_factory end - def process request, response + def process(request, response) unless request.params["REQUEST_METHOD"] == "POST" response.start(404) { } # better way? return @@ -28,7 +28,7 @@ class TSimpleMongrelHTTPServer end end - def initialize processor, opts={} + def initialize(processor, opts={}) port = opts[:port] || 80 ip = opts[:ip] || "0.0.0.0" path = opts[:path] || "" diff --git a/lib/rb/lib/thrift/transport/thttpclient.rb b/lib/rb/lib/thrift/transport/thttpclient.rb index a3f391fe..8eb3fd8e 100644 --- a/lib/rb/lib/thrift/transport/thttpclient.rb +++ b/lib/rb/lib/thrift/transport/thttpclient.rb @@ -8,14 +8,14 @@ require 'stringio' ## Very simple HTTP client class THttpClient < TTransport - def initialize url + def initialize(url) @url = URI url @outbuf = "" end def isOpen; true end - def read sz; @inbuf.read sz end - def write buf; @outbuf << buf end + def read(sz); @inbuf.read sz end + def write(buf); @outbuf << buf end def flush http = Net::HTTP.new @url.host, @url.port resp, data = http.post(@url.path, @outbuf) diff --git a/lib/rb/lib/thrift/transport/ttransport.rb b/lib/rb/lib/thrift/transport/ttransport.rb index e2a55d55..c53e405b 100644 --- a/lib/rb/lib/thrift/transport/ttransport.rb +++ b/lib/rb/lib/thrift/transport/ttransport.rb @@ -275,12 +275,12 @@ end ## ## Assumes both objects are open, remain open, don't require flushing, etc. class TIOStreamTransport < TTransport - def initialize input, output + def initialize(input, output) @input = input @output = output end - def isOpen(); true end + def isOpen; true end def read(sz); @input.read(sz) end def write(buf); @output.write(buf) end end -- 2.17.1