diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-02-05 15:00:00 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-02-05 15:00:00 -0800 |
commit | 686113531d23f30e9973d659c456ae33eb9cff1f (patch) | |
tree | f225de7251a8b49b8d183dd168bab0a0addbe23f /spec/tiny_server.rb | |
parent | d1cf34b059a16a81e0fc48de52ba29863bb41fe6 (diff) | |
download | chef-686113531d23f30e9973d659c456ae33eb9cff1f.tar.gz |
autofixing whitespace cops
4174 Style/SpaceInsideHashLiteralBraces
1860 Style/SpaceAroundOperators
1336 Style/SpaceInsideBlockBraces
1292 Style/AlignHash
997 Style/SpaceAfterComma
860 Style/SpaceAroundEqualsInParameterDefault
310 Style/EmptyLines
294 Style/IndentationConsistency
267 Style/TrailingWhitespace
238 Style/ExtraSpacing
212 Style/SpaceBeforeBlockBraces
166 Style/MultilineOperationIndentation
144 Style/TrailingBlankLines
120 Style/EmptyLineBetweenDefs
101 Style/IndentationWidth
82 Style/SpaceAroundBlockParameters
40 Style/EmptyLinesAroundMethodBody
29 Style/EmptyLinesAroundAccessModifier
1 Style/RescueEnsureAlignment
Diffstat (limited to 'spec/tiny_server.rb')
-rw-r--r-- | spec/tiny_server.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/spec/tiny_server.rb b/spec/tiny_server.rb index 7a58328224..a3711e4dbd 100644 --- a/spec/tiny_server.rb +++ b/spec/tiny_server.rb @@ -31,7 +31,7 @@ module TinyServer attr_writer :app - def self.setup(options=nil, &block) + def self.setup(options = nil, &block) tiny_app = new(options) app_code = Rack::Builder.new(&block).to_app tiny_app.app = app_code @@ -56,7 +56,7 @@ module TinyServer :AccessLog => [] # Remove this option to enable the access log when debugging. } - def initialize(options=nil) + def initialize(options = nil) @options = options ? DEFAULT_OPTIONS.merge(options) : DEFAULT_OPTIONS @creator = caller.first end @@ -128,22 +128,22 @@ module TinyServer end def clear - @routes = {GET => [], PUT => [], POST => [], DELETE => []} + @routes = { GET => [], PUT => [], POST => [], DELETE => [] } end - def get(path, response_code, data=nil, headers=nil, &block) + def get(path, response_code, data = nil, headers = nil, &block) @routes[GET] << Route.new(path, Response.new(response_code, data, headers, &block)) end - def put(path, response_code, data=nil, headers=nil, &block) + def put(path, response_code, data = nil, headers = nil, &block) @routes[PUT] << Route.new(path, Response.new(response_code, data, headers, &block)) end - def post(path, response_code, data=nil, headers=nil, &block) + def post(path, response_code, data = nil, headers = nil, &block) @routes[POST] << Route.new(path, Response.new(response_code, data, headers, &block)) end - def delete(path, response_code, data=nil, headers=nil, &block) + def delete(path, response_code, data = nil, headers = nil, &block) @routes[DELETE] << Route.new(path, Response.new(response_code, data, headers, &block)) end @@ -151,11 +151,11 @@ module TinyServer if response = response_for_request(env) response.call else - debug_info = {:message => "no data matches the request for #{env['REQUEST_URI']}", - :available_routes => @routes, :request => env} + debug_info = { :message => "no data matches the request for #{env['REQUEST_URI']}", + :available_routes => @routes, :request => env } # Uncomment me for glorious debugging # pp :not_found => debug_info - [404, {"Content-Type" => "application/json"}, [ Chef::JSONCompat.to_json(debug_info) ]] + [404, { "Content-Type" => "application/json" }, [ Chef::JSONCompat.to_json(debug_info) ]] end end @@ -185,9 +185,9 @@ module TinyServer end class Response - HEADERS = {"Content-Type" => "application/json"} + HEADERS = { "Content-Type" => "application/json" } - def initialize(response_code=200, data=nil, headers=nil, &block) + def initialize(response_code = 200, data = nil, headers = nil, &block) @response_code, @data = response_code, data @response_headers = headers ? HEADERS.merge(headers) : HEADERS @block = block_given? ? block : nil @@ -199,7 +199,7 @@ module TinyServer end def to_s - "#{@response_code} => #{(@data|| @block)}" + "#{@response_code} => #{(@data || @block)}" end end |