Skip to content

Commit 2b002d4

Browse files
authored
README.md: Update server/client code (#51)
This commit fixes the server/client code example on README.md fixing the following rubocop issues. I confirmed the updated code example worked in my local environment. * C: [Correctable] Layout/SpaceAroundOperators: Surrounding space missing for operator =. * C: [Correctable] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. * C: [Correctable] Layout/EmptyLinesAroundClassBody: Extra empty line detected at class body beginning. * C: [Correctable] Layout/EmptyLinesAroundClassBody: Extra empty line detected at class body end. * C: Naming/AccessorMethodName: Do not prefix reader method names with get_.
1 parent 037ea75 commit 2b002d4

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,16 @@ starting the server code first.
3737
require 'drb/drb'
3838

3939
# The URI for the server to connect to
40-
URI="druby://localhost:8787"
40+
URI = 'druby://localhost:8787'
4141

4242
class TimeServer
43-
44-
def get_current_time
45-
return Time.now
43+
def current_time
44+
Time.now
4645
end
47-
4846
end
4947

5048
# The object that handles requests on the server
51-
FRONT_OBJECT=TimeServer.new
49+
FRONT_OBJECT = TimeServer.new
5250

5351
DRb.start_service(URI, FRONT_OBJECT)
5452
# Wait for the drb server thread to finish before exiting.
@@ -61,7 +59,7 @@ DRb.thread.join
6159
require 'drb/drb'
6260

6361
# The URI to connect to
64-
SERVER_URI="druby://localhost:8787"
62+
SERVER_URI = 'druby://localhost:8787'
6563

6664
# Start a local DRbServer to handle callbacks.
6765

@@ -74,7 +72,7 @@ SERVER_URI="druby://localhost:8787"
7472
DRb.start_service
7573

7674
timeserver = DRbObject.new_with_uri(SERVER_URI)
77-
puts timeserver.get_current_time
75+
puts timeserver.current_time
7876
```
7977

8078
#### Security

0 commit comments

Comments
 (0)