Skip to content

Initial commit. Tests all pass.#98

Open
ericnoble wants to merge 1 commit intopaircolumbus:masterfrom
ericnoble:master
Open

Initial commit. Tests all pass.#98
ericnoble wants to merge 1 commit intopaircolumbus:masterfrom
ericnoble:master

Conversation

@ericnoble
Copy link

@jaybobo, please review.


def fetch_CD_animals(input)
#implement your solution here
input.grep(/^[cdCD].*/)
Copy link
Member

Choose a reason for hiding this comment

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

/^[cdCD]/ would also match strings starting with "c" or "d".

Also, the regex can be marked as "case-insensitive like so: /^[cd]/i.


def fetch_the_dog(input)
#implement your solution here
input.select {|a| a.casecmp("dog") == 0}
Copy link
Member

Choose a reason for hiding this comment

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

a.downcase == "dog" is a bit simpler for the next developer to read.


def capitalize_each_string(input)
#implement your solution here
input.map {|a| a.capitalize}
Copy link
Member

Choose a reason for hiding this comment

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

Rubyists tend to write this as: input.map(&:capitalize). Google "ruby symbol to_proc" for more info. It's hard to explain.

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.

3 participants

Comments