Skip to content

Panda & Tiger level completed - #21

Open
ardder wants to merge 5 commits into
RubyoffRails:masterfrom
ardder:master
Open

Panda & Tiger level completed#21
ardder wants to merge 5 commits into
RubyoffRails:masterfrom
ardder:master

Conversation

@ardder

Copy link
Copy Markdown

No description provided.

Comment threadwatchman.rb Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably recommend to either stick with puts or STDOUT.

@jwo

jwo commented Jul 15, 2013

Copy link
Copy Markdown
Member

Great job! Only stylistic points to mention. yay!

I keep thinking about this line:

puts"1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday, 7: Sunday or Q: Quit"

It's not bad --- but it does repeat some information. Like the WEEK_DAY above as a constant. I might do something like:

COMMANDS={"Q"=>"Quit"}all_choices=WEEK_DAY.merge(COMMANDS)putsall_choices.map{ |k,v| "#{k}: #{v}"}.join(" or ")

Then later, you could do something like

day=select_dayifall_choices[day].nil?puts"invalid choice #{day}, please try again"nextend

Unsure if that really makes it better not, but wanted to show an alternate flow.

@ardder

Copy link
Copy Markdown
Author

I think you are right. I especially like all_choice[day].nil?. It can replace my ugly regex!

BTW, I also finished the assignment of Episode 2. Can you check my code?

Thanks, @jwo

Sign up for freeto 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

@ardder@jwo