Skip to content

Commit 51f2fb4

Browse files
RuboCop.
1 parent c7feab2 commit 51f2fb4

6 files changed

Lines changed: 21 additions & 19 deletions

File tree

examples/raw_mode_probe.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@
4949
STDIN.raw(min: 0, time: 1) do |input|
5050
loop do
5151
chunk = input.read_nonblock(32, exception: false)
52-
52+
5353
case chunk
5454
when :wait_readable, nil
5555
# Keep the process alive while waiting for external signals.
5656
next
5757
else
5858
bytes = chunk.bytes
59-
puts "read #{bytes.length} byte(s): #{bytes.map {|byte| format("0x%02X", byte)}.join(" ")}"
60-
59+
puts "read #{bytes.length} byte(s): #{bytes.map{|byte| format("0x%02X", byte)}.join(" ")}"
60+
6161
break if chunk.include?("q")
6262
break if bytes.include?(3)
6363
end

lib/async/htty/server.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ def self.with_raw_terminal(input, &block)
2828
def self.open(app = nil, input: $stdin, output: $stdout, error: $stderr, env: ENV, **options, &block)
2929
app ||= block
3030
server = self.new(app, **options)
31-
31+
3232
case env["HTTY"]
3333
when "0"
3434
raise DisabledError, "HTTY is disabled!"
3535
when nil
3636
$stderr.puts "HTTY is not supported by this environment, visit https://htty.dev for more information."
3737
raise UnsupportedError, "HTTY is not supported by this environment"
3838
end
39-
39+
4040
unless input.respond_to?(:tty?) && input.tty?
4141
raise UnsupportedError, "HTTY requires a TTY input stream"
4242
end

presentation/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 "presently"

presentation/slides/170-server-code.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ require "async/htty"
1212
require "protocol/http/response"
1313

1414
app = Protocol::HTTP::Middleware.for do |request|
15-
Protocol::HTTP::Response[200,
16-
[["content-type", "text/plain"]],
17-
["Hello World from HTTY\n"]]
15+
Protocol::HTTP::Response[200,
16+
[["content-type", "text/plain"]],
17+
["Hello World from HTTY\n"]]
1818
end
1919

2020
Async::HTTY::Server.open(app)

presentation/slides/171-server-open.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ require "async/htty"
1111
require "protocol/http/response"
1212

1313
app = Protocol::HTTP::Middleware.for do |request|
14-
Protocol::HTTP::Response[200,
15-
[["content-type", "text/plain"]],
16-
["Hello World from HTTY\n"]]
14+
Protocol::HTTP::Response[200,
15+
[["content-type", "text/plain"]],
16+
["Hello World from HTTY\n"]]
1717
end
1818

1919
Async::HTTY::Server.open(app)

test/async/htty/server.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,15 @@ def connection.each
209209

210210
expect(Async::HTTY::DisabledError).to be < Async::HTTY::UnsupportedError
211211
end
212-
212+
213213
it "raises a typed error when stdin is not a tty" do
214214
input = Async::HTTY::FakeFile.new
215215
output = Async::HTTY::FakeFile.new
216-
216+
217217
expect do
218218
subject.open(Protocol::HTTP::Middleware::Okay, input: input, output: output, error: error, env: env)
219219
end.to raise_exception(Async::HTTY::UnsupportedError, message: be =~ /TTY input/)
220-
220+
221221
expect(input.reopen_events).to be == []
222222
expect(output.reopen_events).to be == []
223223
end
@@ -238,12 +238,12 @@ def connection.each
238238

239239
expect(error_output.string).to be(:include?, "https://htty.dev")
240240
end
241-
241+
242242
it "opens a server within its own async context when no task is provided" do
243243
input = Async::HTTY::FakeFile.new(tty: true)
244244
output = Async::HTTY::FakeFile.new
245245
accepted = false
246-
246+
247247
server = Object.new
248248
server.define_singleton_method(:each) do
249249
end
@@ -254,15 +254,15 @@ def connection.each
254254
end
255255
server.define_singleton_method(:close) do
256256
end
257-
257+
258258
protocol = Object.new
259259
protocol.define_singleton_method(:server) do |stream|
260260
accepted = true
261261
server
262262
end
263-
263+
264264
subject.open(Protocol::HTTP::Middleware::Okay, input: input, output: output, error: error, env: env, protocol: protocol)
265-
265+
266266
expect(accepted).to be == true
267267
end
268268
end

0 commit comments

Comments
 (0)