kjson-roda 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aecd0fd2eb4fa562138cf9932ea18dcd54c8a5f9
4
- data.tar.gz: 2a1baf15dabf93d3ccbee63d2cf37eb48b6e29a4
3
+ metadata.gz: cfe02084725e0cf06be435b99653dd536d9b7bb6
4
+ data.tar.gz: 598593e0d6e614510bcf71585f76f92898bcad9f
5
5
  SHA512:
6
- metadata.gz: 30a2e3d70de27a1820d343f9bddc2905e1ce306a430a0483d3d193e7d9ccc9e6de7c0aa542ebf08dff00dda24b3f90c4c621af4dc030c658893cb30df9537395
7
- data.tar.gz: 4c9feb1d648ad101cdc61bf0cbb3bf445c0ce613364804cb90507729f03616d30781ea909beabeab4b19186f265f471df4b6e563a52422c4b0771c3a6dfef2e3
6
+ metadata.gz: 8661a7709bf544f0d88f79174c99001d23c34e9f8e53ce452affa44e4822399216382750d0f203562dcd5371d03516684eac3bc7e95f1e0f37270c79c9099ae9
7
+ data.tar.gz: ea7bdeae72b225ef0a8131c81ce7cdc7fcb1c0a4bad2cfa14c8e7bd2b1488f90555d605ca3c2699a87c40a63f13a846b4aa86b76579adbee18aba975bfd75b43
@@ -66,7 +66,7 @@ module Kjson
66
66
  stored_endpoints = @remaining_endpoints
67
67
  @remaining_endpoints = @remaining_endpoints.drop(path.size)
68
68
  if @remaining_endpoints.empty?
69
- block_result(yield)
69
+ yield
70
70
  throw :error, [NO_DATA, RESPONSE_ERROR] if @remaining_endpoints.empty?
71
71
  else
72
72
  yield
@@ -118,7 +118,7 @@ module Kjson
118
118
  yield
119
119
  }
120
120
  response.data(data)
121
- throw :halt, response.finish
121
+ throw :halt, response.kjson_finish
122
122
  end
123
123
 
124
124
  def catch_error(&_b)
@@ -131,7 +131,7 @@ module Kjson
131
131
  }
132
132
  error = [error] unless error.is_a?(Array)
133
133
  response.error(*error)
134
- throw :halt, response.finish
134
+ throw :halt, response.kjson_finish
135
135
  end
136
136
 
137
137
  def kjson_decode(str)
@@ -164,14 +164,13 @@ module Kjson
164
164
  nil
165
165
  end
166
166
 
167
- def finish
168
- if @kjson_response
169
- @body = [kjson_encode(
170
- "data" => @data,
171
- "error" => @error
172
- )]
173
- end
174
- super
167
+ def kjson_finish
168
+ raise Roda::RodaError, "should call #data or #error before finish response" unless @kjson_response
169
+ write(kjson_encode(
170
+ "data" => @data,
171
+ "error" => @error
172
+ ))
173
+ finish
175
174
  end
176
175
 
177
176
  private
@@ -1,5 +1,5 @@
1
1
  module Kjson
2
2
  module Roda
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kjson-roda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maksim V.
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  version: '0'
120
120
  requirements: []
121
121
  rubyforge_project:
122
- rubygems_version: 2.6.8
122
+ rubygems_version: 2.4.8
123
123
  signing_key:
124
124
  specification_version: 4
125
125
  summary: KJson Roda plugin