Episode 1 Assignments#10
Conversation
blackjack.rb
Outdated
There was a problem hiding this comment.
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.