Skip to content

Commit

Permalink
ruby lint
Browse files Browse the repository at this point in the history
- Apply new Hash style
- {} is prefered for block in case of single line
  • Loading branch information
mttrs committed Sep 8, 2015
1 parent 3292397 commit 0138d00
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
puts "Server started: http://localhost:#{port}/"

root = File.expand_path './public'
server = WEBrick::HTTPServer.new :Port => port, :DocumentRoot => root
server = WEBrick::HTTPServer.new Port: port, DocumentRoot: root

server.mount_proc '/comments.json' do |req, res|
comments = JSON.parse(File.read('./comments.json'))
Expand All @@ -28,7 +28,7 @@
comment[key] = value.force_encoding('UTF-8')
end
comments << comment
File.write('./comments.json', JSON.pretty_generate(comments, :indent => ' '))
File.write('./comments.json', JSON.pretty_generate(comments, indent: ' '))
end

# always return json
Expand All @@ -37,6 +37,6 @@
res.body = JSON.generate(comments)
end

trap 'INT' do server.shutdown end
trap('INT') { server.shutdown }

server.start

0 comments on commit 0138d00

Please sign in to comment.