Skip to content

Commit 704c1ef

Browse files
committed
Modernize code.
1 parent 64b0da6 commit 704c1ef

File tree

12 files changed

+30
-28
lines changed

12 files changed

+30
-28
lines changed

.gitignore

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
1-
/.bundle/
2-
/pkg/
1+
/.bundle
2+
/pkg
33
/gems.locked
44
/.covered.db
55
/external
66

7-
/.bundle/
8-
/.yardoc
9-
/gems.locked
10-
/_yardoc/
11-
/coverage/
12-
/doc/
13-
/pkg/
14-
/spec/reports/
15-
/tmp/
16-
177
.rspec_status
188
.covered.db

.rubocop.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ Layout/EmptyLinesAroundModuleBody:
4848
Layout/EmptyLineAfterMagicComment:
4949
Enabled: true
5050

51+
Layout/SpaceInsideBlockBraces:
52+
Enabled: true
53+
EnforcedStyle: no_space
54+
SpaceBeforeBlockParameters: false
55+
56+
Layout/SpaceAroundBlockParameters:
57+
Enabled: true
58+
EnforcedStyleInsidePipes: no_space
59+
5160
Style/FrozenStringLiteralComment:
5261
Enabled: true
5362

examples/call/config.ru

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class App
2323
EOF
2424

2525
template = Trenni::Template.new(buffer)
26-
body = DeferredBody.new(->(stream){ template.to_string({}, Output.new(stream)) })
26+
body = DeferredBody.new(->(stream){template.to_string({}, Output.new(stream))})
2727

2828
[200, {}, body]
2929
end

examples/headers/config.ru

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ require "cgi"
44

55
# curl 'http://localhost:9292/?xid=1%0DSet-Cookie:%20foo%3Dbar'
66

7-
run ->(env) {
7+
run do |env|
88
params = CGI.parse env["QUERY_STRING"]
99
header = params.fetch("xid", []).first || ""
1010

1111
[200, {"xid" => "m" + header }, ["hello"]]
12-
}
12+
end

examples/post/client.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#!/usr/bin/env ruby
22
# frozen_string_literal: true
33

4+
# Released under the MIT License.
5+
# Copyright, 2025, by Samuel Williams.
6+
47
require "async/http"
58
require "async/http/internet/instance"
69

examples/streaming_upload/config.ru

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class BodyHandler
4141
end
4242
end
4343

44-
run lambda { |env|
44+
run do |env|
4545
request = env["protocol.http.request"]
4646
handler = BodyHandler.new(env["rack.input"], env["CONTENT_LENGTH"])
4747
Console.info(self, "#{env['REQUEST_METHOD']} #{handler.uuid}: #{request.path} #{env['CONTENT_LENGTH']}")
@@ -60,4 +60,4 @@ run lambda { |env|
6060
sleep 1
6161
[200, {}, ["#{env['REQUEST_METHOD']}: #{request.path}\n"]]
6262
end
63-
}
63+
end

examples/trailer/config.ru

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ use RequestLogger
1818
run lambda {|env|
1919
start_time = Async::Clock.now
2020

21-
server_timing = ->{
22-
"app;dur=#{Async::Clock.now - start_time}"
23-
}
21+
server_timing = ->{"app;dur=#{Async::Clock.now - start_time}"}
2422

2523
[
2624
200,

examples/unicorn/falcon.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
include Falcon::Environment::Rack
1212

1313
scheme "http"
14-
protocol {Async::HTTP::Protocol::HTTP1.new(
15-
persistent: false,
16-
)}
14+
protocol do
15+
Async::HTTP::Protocol::HTTP1.new(
16+
persistent: false,
17+
)
18+
end
1719

1820
# Extend the endpoint options to include the (connection) limited wrapper.
1921
endpoint_options do

test/falcon/command/config.ru

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# frozen_string_literal: true
22

33
# This echos the body back.
4-
run lambda { |env| [200, {}, env["rack.input"] || []] }
4+
run lambda {|env| [200, {}, env["rack.input"] || []]}

test/falcon/command/serve.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
end
3838

3939
describe Falcon::Command::Serve do
40-
let(:options) { [] }
40+
let(:options) {[]}
4141

4242
with "custom port" do
4343
let(:port) {8090}

0 commit comments

Comments
 (0)