Skip to content

Conversation

@Meshed
Copy link

@Meshed Meshed commented Nov 15, 2012

I even threw in an extra.

blackjack.rb Outdated
Copy link
Member

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

@jwo
Copy link
Member

jwo commented Nov 16, 2012

well done! I left some stylistic suggestions... let me know what you think!

@jwo
Copy link
Member

jwo commented Nov 29, 2012

OK, so this failed the build with TravisCI (https://travis-ci.org/RubyoffRails/Episode1-Summer2012/builds/3411231)

Why do you think it's failing?

@Meshed
Copy link
Author

Meshed commented Nov 29, 2012

Because I already had a class property named suit and it was trying to
execute the '-' operator on the two variables instead of being a variable
name.

On Wed, Nov 28, 2012 at 10:23 PM, Jesse Wolgamott
notifications@github.comwrote:

OK, so this failed the build with TravisCI (
https://travis-ci.org/RubyoffRails/Episode1-Summer2012/builds/3411231)

Why do you think it's failing?


Reply to this email directly or view it on GitHubhttps://github.com//pull/10#issuecomment-10833692.

Thank you,

Mark Brown
(904) 385-0871
http://www.rubybacon.com

@jwo
Copy link
Member

jwo commented Nov 29, 2012

Yep yep --- I wish we could have variable names with dashes in Ruby, but sadly negative.

@Meshed
Copy link
Author

Meshed commented Nov 29, 2012

I had forgotten the tests were in the same file for that one.

On Wed, Nov 28, 2012 at 10:40 PM, Jesse Wolgamott
notifications@github.comwrote:

Yep yep --- I wish we could have variable names with dashes in Ruby, but
sadly negative.


Reply to this email directly or view it on GitHubhttps://github.com//pull/10#issuecomment-10833940.

Thank you,

Mark Brown
(904) 385-0871
http://www.rubybacon.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants