Skip to content

Commit 0138d00

Browse files
committed
ruby lint
- Apply new Hash style - {} is prefered for block in case of single line
1 parent 3292397 commit 0138d00

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

server.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
puts "Server started: http://localhost:#{port}/"
1717

1818
root = File.expand_path './public'
19-
server = WEBrick::HTTPServer.new :Port => port, :DocumentRoot => root
19+
server = WEBrick::HTTPServer.new Port: port, DocumentRoot: root
2020

2121
server.mount_proc '/comments.json' do |req, res|
2222
comments = JSON.parse(File.read('./comments.json'))
@@ -28,7 +28,7 @@
2828
comment[key] = value.force_encoding('UTF-8')
2929
end
3030
comments << comment
31-
File.write('./comments.json', JSON.pretty_generate(comments, :indent => ' '))
31+
File.write('./comments.json', JSON.pretty_generate(comments, indent: ' '))
3232
end
3333

3434
# always return json
@@ -37,6 +37,6 @@
3737
res.body = JSON.generate(comments)
3838
end
3939

40-
trap 'INT' do server.shutdown end
40+
trap('INT') { server.shutdown }
4141

4242
server.start

0 commit comments

Comments
 (0)