From 479967e54b0121040588300f7ec3a535a0c33707 Mon Sep 17 00:00:00 2001 From: mshecket Date: Sun, 10 Nov 2019 01:04:45 -0500 Subject: [PATCH] Here's my solution! --- challenge.rb | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/challenge.rb b/challenge.rb index 0585882..9006445 100644 --- a/challenge.rb +++ b/challenge.rb @@ -1,26 +1,39 @@ def capitalize_each_string(input) - #implement your solution here + # Use map to apply the String.capitalize + # method to each string in the array + input.map { |item| item.capitalize } end def fetch_the_dog(input) - #implement your solution here + # Use select to filter for only items + # that have the string value "dog" + input.select { |item| item == "dog" } end def no_dogs_allowed(input) - #implement your solution here + # Use select to filter for only items + # that do not have the string value "dog" + input.select { |item| item != "dog" } end def count_the_animals(input) - #implement your solution here + # Use count to count the elements + input.count end def fetch_the_first_two(input) - #implement your solution here + # Use first to get the first two + # elements of the Enumerable + input.first(2) end def fetch_CD_animals(input) - #implement your solution here + # Use select to filter for strings + # that have either "c" or "d" as + # their first character + input.select { |item| + item[0,1] == "c" or item[0,1] == "d" } end ## DO NOT CHANGE CODE BELOW THIS LINE ##