-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pr-10 #11
base: master
Are you sure you want to change the base?
Pr-10 #11
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall all good.
end | ||
|
||
def to_roman | ||
n = self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More descriptive variable names
require 'minitest/autorun' | ||
require_relative 'roman_numerals' | ||
|
||
# Common test data version: 1.0.0 070e8d5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add edge cases?
I like how you committed your tests before committing your code. Red-green-refactor! |
end | ||
|
||
def to_roman | ||
n = self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would benefit to leave comment that n is an instance of Fixnum, which gets converted to roman via to_roman
@@ -0,0 +1,30 @@ | |||
class Fixnum | |||
|
|||
def roman |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this is in a method?
result = "" | ||
roman.each do |num, letter| | ||
result << letter * (n / num) | ||
n = n % num |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be slightly shortened with n %= num
end | ||
|
||
def test_2 | ||
skip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to be skipping these tests? We probably want to comment these out.
@@ -0,0 +1,30 @@ | |||
class Fixnum | |||
|
|||
def roman |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we think about making this an instance variable vs. a function?
No description provided.