low_loop 0.6.1 → 0.7.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
  SHA256:
3
- metadata.gz: a81d820a9454fadf98b574e9214a918f48034192278273e94ed1b6567a0a674a
4
- data.tar.gz: 4a8283d296161ae26eccd8ccee4f10ca55dd8338d45e3f5489123f7f609e00e4
3
+ metadata.gz: 86d7096079d428e5b977514b850c2c8d7d22c692ff5f6b24c31836edfb5a26c3
4
+ data.tar.gz: eb5ce84e3edaa8eadde575b0133d0096e738d9ef58f2b57d5d89051238f3bec4
5
5
  SHA512:
6
- metadata.gz: f188f954f821c854bca74af08ea514d715ef4199d6ac3122ef30a8220c8b529b54e68b7b4138f1dc3bce30d3cd4875aa019c48352141404db1bee7287a5ff48b
7
- data.tar.gz: 73bbdcdd0ea998ae98a4e382fbfc977f9b034c789e7c26a6a741cbf5e449cc34469015cd29c94190df3aa4e47c6deeb726c3a221831c19ef073817b3690e7c3f
6
+ metadata.gz: f37c5de2f7322c8cdc639e7037a1686b29c4396823aef2436e3263f88a606f22f266afb494758172d1a10efb23ef0868870135d3e7ca0c14766bb8bde8901455
7
+ data.tar.gz: 69df08688e56bc974a6e204b4c3e309373dc8907191548c97fdfebf08ee59f981626ed51ec5de0b4fddc5323a04700ebf38b91566c7d0a486441d49b441d6d5f
@@ -8,14 +8,14 @@ module Low
8
8
  class ResponseFactory
9
9
  class << self
10
10
  def html(body:)
11
- headers = Protocol::HTTP::Headers.new(['content-type', 'text/html'])
12
- body = Protocol::HTTP::Body::Buffered.wrap(body)
11
+ headers = Protocol::HTTP::Headers.new([['content-type', 'text/html']])
12
+ body = Protocol::HTTP::Body::Buffered.wrap(body.strip)
13
13
 
14
14
  Protocol::HTTP::Response.new('HTTP/1.1', 200, headers, body)
15
15
  end
16
16
 
17
17
  def file(path:, content_type:)
18
- headers = Protocol::HTTP::Headers.new(['content-type', content_type])
18
+ headers = Protocol::HTTP::Headers.new([['content-type', content_type]])
19
19
  file = File.open(path, 'rb')
20
20
  body = Protocol::HTTP::Body::File.new(file)
21
21
 
data/lib/low_loop.rb CHANGED
@@ -90,18 +90,18 @@ class LowLoop
90
90
 
91
91
  private
92
92
 
93
- def render_error(e)
93
+ def render_error(error)
94
94
  puts "\nException:"
95
- puts Paint[e.message, :red]
95
+ puts Paint[error.message, :red]
96
96
  puts ''
97
97
 
98
- if @config.debug_mode
99
- Fiber.blocking do
100
- puts Paint[e.backtrace.join("\n"), :blue]
101
- puts ''
102
- puts 'Press ENTER to continue...'
103
- gets
104
- end
98
+ return unless @config.debug_mode
99
+
100
+ Fiber.blocking do
101
+ puts Paint[error.backtrace.join("\n"), :blue]
102
+ puts ''
103
+ puts 'Press ENTER to continue...'
104
+ gets
105
105
  end
106
106
  end
107
107
 
@@ -10,7 +10,7 @@ module Low
10
10
 
11
11
  if File.exist?(file.path)
12
12
  response = Factories::ResponseFactory.file(path: file.path, content_type: file.content_type)
13
- return Events::ResponseEvent.new(response:).tap { it.branch }
13
+ return Events::ResponseEvent.new(response:).tap(&:branch)
14
14
  end
15
15
 
16
16
  nil
@@ -37,7 +37,7 @@ module Low
37
37
  end
38
38
 
39
39
  def write_response_headers(socket, response)
40
- response.headers.fields.each_slice(2) do |key, value|
40
+ response.headers.fields.each do |key, value|
41
41
  next if %w[content-length connection].include?(key.to_s.downcase)
42
42
 
43
43
  socket.puts "#{key}: #{value}\r\n"
data/lib/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Low
4
4
  module Loop
5
- VERSION = '0.6.1'
5
+ VERSION = '0.7.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: low_loop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - maedi
@@ -152,14 +152,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
152
152
  requirements:
153
153
  - - ">="
154
154
  - !ruby/object:Gem::Version
155
- version: 3.3.0
155
+ version: 3.4.0
156
156
  required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  requirements:
158
158
  - - ">="
159
159
  - !ruby/object:Gem::Version
160
160
  version: '0'
161
161
  requirements: []
162
- rubygems_version: 4.0.10
162
+ rubygems_version: 4.0.6
163
163
  specification_version: 4
164
164
  summary: An event-driven event loop
165
165
  test_files: []