diff options
| author | Markus Roberts <Markus@reality.com> | 2010-07-09 18:07:15 -0700 |
|---|---|---|
| committer | Markus Roberts <Markus@reality.com> | 2010-07-09 18:07:15 -0700 |
| commit | 543225970225de5697734bfaf0a6eee996802c04 (patch) | |
| tree | ecc6f639c43cf1812e64f9c6ce7eacc0922b57ff /lib/puppet/network/http | |
| parent | 8f15707251cdb58d53e82c4bbd332a38c2d31b4c (diff) | |
| download | puppet-543225970225de5697734bfaf0a6eee996802c04.tar.gz puppet-543225970225de5697734bfaf0a6eee996802c04.tar.xz puppet-543225970225de5697734bfaf0a6eee996802c04.zip | |
Code smell: Avoid needless decorations
* Replaced 704 occurances of (.*)\b([a-z_]+)\(\) with \1\2
3 Examples:
The code:
ctx = OpenSSL::SSL::SSLContext.new()
becomes:
ctx = OpenSSL::SSL::SSLContext.new
The code:
skip()
becomes:
skip
The code:
path = tempfile()
becomes:
path = tempfile
* Replaced 31 occurances of ^( *)end *#.* with \1end
3 Examples:
The code:
becomes:
The code:
end # Dir.foreach
becomes:
end
The code:
end # def
becomes:
end
Diffstat (limited to 'lib/puppet/network/http')
| -rw-r--r-- | lib/puppet/network/http/compression.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/network/http/rack.rb | 6 | ||||
| -rw-r--r-- | lib/puppet/network/http/rack/httphandler.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/network/http/rack/xmlrpc.rb | 4 | ||||
| -rw-r--r-- | lib/puppet/network/http/webrick/rest.rb | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/lib/puppet/network/http/compression.rb b/lib/puppet/network/http/compression.rb index 923262b98..bb06a5770 100644 --- a/lib/puppet/network/http/compression.rb +++ b/lib/puppet/network/http/compression.rb @@ -20,7 +20,7 @@ module Puppet::Network::HTTP::Compression when 'gzip' return Zlib::GzipReader.new(StringIO.new(response.body)).read when 'deflate' - return Zlib::Inflate.new().inflate(response.body) + return Zlib::Inflate.new.inflate(response.body) when nil, 'identity' return response.body else diff --git a/lib/puppet/network/http/rack.rb b/lib/puppet/network/http/rack.rb index a5f69612d..b7da1fcf7 100644 --- a/lib/puppet/network/http/rack.rb +++ b/lib/puppet/network/http/rack.rb @@ -11,7 +11,7 @@ class Puppet::Network::HTTP::Rack protocols = args[:protocols] # Always prepare a REST handler - @rest_http_handler = Puppet::Network::HTTP::RackREST.new() + @rest_http_handler = Puppet::Network::HTTP::RackREST.new protocols.delete :rest # Prepare the XMLRPC handler, for backward compatibility (if requested) @@ -33,7 +33,7 @@ class Puppet::Network::HTTP::Rack # * Return the response (in rack-format) to our caller. def call(env) request = Rack::Request.new(env) - response = Rack::Response.new() + response = Rack::Response.new Puppet.debug 'Handling request: %s %s' % [request.request_method, request.fullpath] # if we shall serve XMLRPC, have /RPC2 go to the xmlrpc handler @@ -56,7 +56,7 @@ class Puppet::Network::HTTP::Rack Puppet.err "Backtrace:" detail.backtrace.each { |line| Puppet.err " > #{line}" } end - response.finish() + response.finish end end diff --git a/lib/puppet/network/http/rack/httphandler.rb b/lib/puppet/network/http/rack/httphandler.rb index e14206850..fed06f880 100644 --- a/lib/puppet/network/http/rack/httphandler.rb +++ b/lib/puppet/network/http/rack/httphandler.rb @@ -3,7 +3,7 @@ require 'puppet/ssl/certificate' class Puppet::Network::HTTP::RackHttpHandler - def initialize() + def initialize end # do something useful with request (a Rack::Request) and use diff --git a/lib/puppet/network/http/rack/xmlrpc.rb b/lib/puppet/network/http/rack/xmlrpc.rb index 9192b1d48..c3209a686 100644 --- a/lib/puppet/network/http/rack/xmlrpc.rb +++ b/lib/puppet/network/http/rack/xmlrpc.rb @@ -23,7 +23,7 @@ class Puppet::Network::HTTP::RackXMLRPC < Puppet::Network::HTTP::RackHttpHandler response.write 'Method Not Allowed' return end - if request.media_type() != "text/xml" + if request.media_type != "text/xml" response.status = 400 response.write 'Bad Request' return @@ -32,7 +32,7 @@ class Puppet::Network::HTTP::RackXMLRPC < Puppet::Network::HTTP::RackHttpHandler # get auth/certificate data client_request = build_client_request(request) - response_body = @xmlrpc_server.process(request.body.read(), client_request) + response_body = @xmlrpc_server.process(request.body.read, client_request) response.status = 200 response['Content-Type'] = 'text/xml; charset=utf-8' diff --git a/lib/puppet/network/http/webrick/rest.rb b/lib/puppet/network/http/webrick/rest.rb index 9a8bf0a83..7526099ee 100644 --- a/lib/puppet/network/http/webrick/rest.rb +++ b/lib/puppet/network/http/webrick/rest.rb @@ -18,7 +18,7 @@ class Puppet::Network::HTTP::WEBrickREST < WEBrick::HTTPServlet::AbstractServlet result.merge(client_information(request)) end - # WEBrick uses a service() method to respond to requests. Simply delegate to the handler response() method. + # WEBrick uses a service method to respond to requests. Simply delegate to the handler response method. def service(request, response) process(request, response) end |
