hatetepe 0.0.2 → 0.0.3

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.
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2011 Lars Gierth
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -71,8 +71,10 @@ module Hatetepe
71
71
  if Array === code
72
72
  response(code[0])
73
73
  code[1].each_pair {|name, value| header(name, value) }
74
- code[2].each {|chunk| body(chunk) }
75
- complete
74
+ if code[2]
75
+ code[2].each {|chunk| body(chunk) }
76
+ complete
77
+ end
76
78
  return
77
79
  end
78
80
 
@@ -144,8 +146,11 @@ module Hatetepe
144
146
  def error(message)
145
147
  exception = BuilderError.new(message)
146
148
  exception.set_backtrace(caller[1..-1])
147
- on_error.each {|blk| blk.call(exception) }
148
- raise(exception)
149
+ unless on_error.empty?
150
+ on_error.each {|blk| blk.call(exception) }
151
+ else
152
+ raise(exception)
153
+ end
149
154
  end
150
155
  end
151
156
  end
@@ -93,8 +93,11 @@ module Hatetepe
93
93
  rescue HTTP::Parser::Error => original_error
94
94
  error = ParserError.new(original_error.message)
95
95
  error.set_backtrace(original_error.backtrace)
96
- on_error.each {|e| e.call(error) }
97
- raise(error)
96
+ unless on_error.empty?
97
+ on_error.each {|e| e.call(error) }
98
+ else
99
+ raise(error)
100
+ end
98
101
  end
99
102
  end
100
103
  end
@@ -1,3 +1,3 @@
1
1
  module Hatetepe
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: hatetepe
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Lars Gierth
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-06 00:00:00 Z
13
+ date: 2011-06-15 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http_parser.rb
@@ -45,6 +45,7 @@ extra_rdoc_files: []
45
45
 
46
46
  files:
47
47
  - Gemfile
48
+ - LICENSE
48
49
  - README.md
49
50
  - Rakefile
50
51
  - example.rb
@@ -70,7 +71,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
70
71
  requirements:
71
72
  - - ">="
72
73
  - !ruby/object:Gem::Version
73
- hash: -899733391
74
+ hash: 855126803
74
75
  segments:
75
76
  - 0
76
77
  version: "0"
@@ -79,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
80
  requirements:
80
81
  - - ">="
81
82
  - !ruby/object:Gem::Version
82
- hash: -899733391
83
+ hash: 855126803
83
84
  segments:
84
85
  - 0
85
86
  version: "0"