From 0d06acb66999c8527d5344794ad5684bb829e843 Mon Sep 17 00:00:00 2001 From: Shawn Isenhart Date: Tue, 2 Oct 2018 13:26:52 -0500 Subject: [PATCH] Update clock example solution to match style guide The [ruby style guide](https://github.com/rubocop-hq/ruby-style-guide#sprintf) currently suggests to use `format` or `sprintf` instead of `String#%`. In addition, the `self` in the hash method is redundant, the [style guide](https://github.com/rubocop-hq/ruby-style-guide#no-self-unless-required) also recommends not including it here. --- tracks/ruby/exercises/clock/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tracks/ruby/exercises/clock/README.md b/tracks/ruby/exercises/clock/README.md index c4c40d6..9c5cfd6 100644 --- a/tracks/ruby/exercises/clock/README.md +++ b/tracks/ruby/exercises/clock/README.md @@ -17,7 +17,7 @@ class Clock end def to_s - "%02d:%02d" % time.divmod(MINUTES_PER_HOUR) + format("%02d:%02d", *time.divmod(MINUTES_PER_HOUR)) end def +(other) @@ -34,7 +34,7 @@ class Clock alias eql? == def hash - [self.class, self.time].hash + [self.class, time].hash end protected