From 3391f6748204aafb4de097d1c296429566e77a66 Mon Sep 17 00:00:00 2001 From: burnettk Date: Thu, 25 Dec 2014 17:18:07 -0500 Subject: [PATCH 1/2] use single quotes where you don't need doubles --- lib/apipie/extractor/writer.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/apipie/extractor/writer.rb b/lib/apipie/extractor/writer.rb index 95360e1a..fcdef3e0 100644 --- a/lib/apipie/extractor/writer.rb +++ b/lib/apipie/extractor/writer.rb @@ -294,8 +294,8 @@ def generate_apis_code(apis) "List #{name}" end - code << "api :#{api[:method]}, \"#{api[:path]}\"" - code << ", \"#{desc}\"" if desc + code << "api :#{api[:method]}, '#{api[:path]}'" + code << ", '#{desc}'" if desc code << "\n" end return code @@ -307,7 +307,7 @@ def generate_params_code(params, indent = "") desc[:type] = (desc[:type] && desc[:type].first) || Object code << "#{indent}param" if name =~ /\W/ - code << " :\"#{name}\"" + code << " :'#{name}'" else code << " :#{name}" end From cb6625ee63089c967c449f09cc64e4ac0518ed5c Mon Sep 17 00:00:00 2001 From: burnettk Date: Thu, 25 Dec 2014 19:24:19 -0500 Subject: [PATCH 2/2] use ruby 1.9 style hash syntax since we're not supporting 1.8 --- lib/apipie/extractor/writer.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/apipie/extractor/writer.rb b/lib/apipie/extractor/writer.rb index fcdef3e0..ca010adc 100644 --- a/lib/apipie/extractor/writer.rb +++ b/lib/apipie/extractor/writer.rb @@ -313,10 +313,10 @@ def generate_params_code(params, indent = "") end code << ", #{desc[:type].inspect}" if desc[:allow_nil] - code << ", :allow_nil => true" + code << ", allow_nil: true" end if desc[:required] - code << ", :required => true" + code << ", required: true" end if desc[:nested] code << " do\n" @@ -332,7 +332,7 @@ def generate_params_code(params, indent = "") def generate_errors_code(errors) code = "" errors.sort_by {|e| e[:code] }.each do |error| - code << "error :code => #{error[:code]}\n" + code << "error code: #{error[:code]}\n" end code end