Skip to content

Commit 310a8ed

Browse files
RuboCop multi-protocol example.
1 parent 75a107b commit 310a8ed

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

examples/multi-protocol/falcon.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
# Define HTTP/1 endpoint configuration:
1414
http1 = environment do
1515
include Falcon::Environment::Server
16-
16+
1717
scheme "http"
18-
protocol { Async::HTTP::Protocol::HTTP1 }
19-
18+
protocol {Async::HTTP::Protocol::HTTP1}
19+
2020
endpoint do
2121
Async::HTTP::Endpoint.for(
2222
scheme,
@@ -30,10 +30,10 @@
3030
# Define HTTP/2 endpoint configuration:
3131
http2 = environment do
3232
include Falcon::Environment::Server
33-
33+
3434
scheme "http"
35-
protocol { Async::HTTP::Protocol::HTTP2 }
36-
35+
protocol {Async::HTTP::Protocol::HTTP2}
36+
3737
endpoint do
3838
Async::HTTP::Endpoint.for(
3939
scheme,
@@ -47,28 +47,28 @@
4747
# Main service that runs the same application on both endpoints:
4848
service "multi-protocol" do
4949
include Falcon::Environment::Rack
50-
51-
protocol_http1 { http1.with(middleware: self.middleware).evaluator }
52-
protocol_http2 { http2.with(middleware: self.middleware).evaluator }
53-
50+
51+
protocol_http1 {http1.with(middleware: self.middleware).evaluator}
52+
protocol_http2 {http2.with(middleware: self.middleware).evaluator}
53+
5454
# Use NamedEndpoints to combine both endpoints:
5555
endpoint do
5656
endpoints = {
5757
protocol_http1: protocol_http1.endpoint,
5858
protocol_http2: protocol_http2.endpoint
5959
}
60-
60+
6161
IO::Endpoint::NamedEndpoints.new(endpoints)
6262
end
63-
63+
6464
# Create servers for each named endpoint:
6565
make_server do |bound_endpoint|
6666
servers = {}
67-
67+
6868
bound_endpoint.each do |name, endpoint|
6969
servers[name.to_s] = self[name].make_server(endpoint)
7070
end
71-
71+
7272
Falcon::CompositeServer.new(servers)
7373
end
7474
end

examples/multi-protocol/gems.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
source "https://rubygems.org"
24

35
gem "falcon", path: "../../"

0 commit comments

Comments
 (0)