-
Notifications
You must be signed in to change notification settings - Fork 45
Episode 1 Assignments #10
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
base: master
Are you sure you want to change the base?
Conversation
blackjack.rb
Outdated
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.
I think this could be confusing to later-you in a couple of months... There''s an attr_reader :suit in this class. You're not writing over that variable (since it was a reader), but you could be if that gets changed later on.
Possibly something like this would be more explicit
def to_s
"#{suit_abbreviation}-#{value}"
end
def suit_abbreviation
case suit
when :diamonds then "D"
when :hearts then "H"
when :spaids then "S"
when :clubs then "C"
end
end
Of course, you could even do this if you wanted
def to_s
"#{suit.to_s[0].upcase}-{value}"
end
|
well done! I left some stylistic suggestions... let me know what you think! |
|
OK, so this failed the build with TravisCI (https://travis-ci.org/RubyoffRails/Episode1-Summer2012/builds/3411231) Why do you think it's failing? |
|
Because I already had a class property named suit and it was trying to On Wed, Nov 28, 2012 at 10:23 PM, Jesse Wolgamott
Thank you, Mark Brown |
|
Yep yep --- I wish we could have variable names with dashes in Ruby, but sadly negative. |
|
I had forgotten the tests were in the same file for that one. On Wed, Nov 28, 2012 at 10:40 PM, Jesse Wolgamott
Thank you, Mark Brown |
I even threw in an extra.