grape-dsl 2.2.1 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d7f0e1da4083899e3f9f29e9f005cd37516fa52
4
- data.tar.gz: 65b5b347c5c2d40a0d0c59a7cd544e506e42ac3f
3
+ metadata.gz: 4dc18b0dd29b0369d3c564db0447d1efc158ebc5
4
+ data.tar.gz: 4b1d89dd10ea8c441f6a0384cecb4d13149f2313
5
5
  SHA512:
6
- metadata.gz: ec22bd9a3ddb8c4854ca1644c13130bb003f106339ba161afbf22480395e78907cf560ec6dff79c8c4199f8949e88e2670ede0d2a510e515d013c03559c5bcae
7
- data.tar.gz: 34ac2f981b70dff8472578453afcec80822f1148411563e0cbd68ca660faa3f87c7417f78bc89c7b6f75c3cca5ace19e65d261e9ba4e7631b41b0b4a969525df
6
+ metadata.gz: dc1f89349bde5ca96e2b5b50ff8219ee663007be8d3d2172955ac24a795623b1635d733a049882250aee65afdacbfb5a4da6abac4b157b1c2734c4c2c7b65748
7
+ data.tar.gz: d0064cc0334ab78b34e772a37f39abdb0057a33f4753e039e89c31a99561fd48fc64ebcca9c8eca38a3c9f40db35412782c476bfd164ef126c1f63595ab78b07
data/TODO ADDED
@@ -0,0 +1 @@
1
+ refactor doc generation logic with description logic
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.2.1
1
+ 2.3.0
@@ -83,38 +83,40 @@ module GrapeDSL
83
83
 
84
84
  end
85
85
 
86
- content_type ||= "TXT"
87
- case content_type.to_s.downcase
86
+ content_type ||= 'TXT'
87
+ content_type = content_type.keys if content_type.class <= ::Hash
88
88
 
89
- when "json"
90
- begin
89
+ [*content_type].each do |one_content_type|
91
90
 
92
- tmp_array.push [wrapper_begin,content_type.to_s,wrapper_end].join
91
+ case one_content_type.to_s.downcase
93
92
 
94
- require "json"
93
+ when 'json'
94
+ begin
95
95
 
96
- formatted_string= params.to_json
96
+ tmp_array.push [wrapper_begin,one_content_type.to_s,wrapper_end].join
97
97
 
98
- {
99
- "{" => "{\n",
100
- "}" => "\n}",
101
- "," => ",\n"
102
- }.each do |from,to|
103
- formatted_string.gsub!(from,to)
104
- end
98
+ require 'json'
105
99
 
106
- formatted_string.gsub!(/^"/," \"")
100
+ formatted_string= params.to_json
107
101
 
108
- tmp_array.push formatted_string
109
- tmp_array.push wrapper_close
110
- end
102
+ {
103
+ '{' => "{\n",
104
+ '}' => "\n}",
105
+ ',' => ",\n"
106
+ }.each do |from,to|
107
+ formatted_string.gsub!(from,to)
108
+ end
111
109
 
112
- when "txt"
113
- begin
114
- tmp_array.push(params.inspect)
115
- end
110
+ formatted_string.gsub!(/^"/," \"")
111
+ tmp_array.push formatted_string
112
+ tmp_array.push wrapper_close
113
+
114
+ end
116
115
 
116
+ when "txt"
117
+ tmp_array.push(params.inspect)
117
118
 
119
+ end
118
120
 
119
121
  end
120
122
 
@@ -12,7 +12,13 @@ module GrapeDSL
12
12
 
13
13
  @last_description ||= {}
14
14
  unless @last_description[:description].class == Hashie::Mash
15
- @last_description[:description]= Hashie::Mash.new(opts.merge(desc: @last_description[:desc]))
15
+
16
+ @last_description[:description]= Hashie::Mash.new(
17
+ opts.merge(
18
+ desc: @last_description[:desc],
19
+ content_type: self.content_types
20
+ )
21
+ )
16
22
  end
17
23
  return @last_description[:description]
18
24
 
@@ -62,7 +68,7 @@ module GrapeDSL
62
68
  end
63
69
 
64
70
  alias :cw_routes :console_write_out_routes
65
-
71
+ alias :puts_routes :console_write_out_routes
66
72
 
67
73
  end
68
74
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Luzsi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-25 00:00:00.000000000 Z
11
+ date: 2014-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mpatch
@@ -51,6 +51,7 @@ files:
51
51
  - LICENSE
52
52
  - README.md
53
53
  - Rakefile
54
+ - TODO
54
55
  - VERSION
55
56
  - files.rb
56
57
  - grape-dsl.gemspec