Question: RUBY CODE: For the following code, 1)Write the Ruby code in this method that will return the contacts hash with emails populated from the array.

RUBY CODE:

For the following code,

RUBY CODE: For the following code, 1)Write the Ruby code in thismethod that will return the contacts hash with emails populated from thearray. 2)Write the Ruby code in this method that will return the

1)Write the Ruby code in this method that will return the contacts hash with emails populated from the array.

2)Write the Ruby code in this method that will return the contacts hash with the email address and phone number hash populated for each contact.

3)Write the Ruby code in this method that will create three arrays of type string from the hash and then will return an array that contains these three arrays (a two dimensional array!).

Example:

[["bobsmith@example.com"],["555-555-5555"],["Bob Smith"]]

Will place code here:

contacts hash with the email address and phone number hash populated for

1 require 'hashes.rb" 3 RSpec.configure do Iconfigl config.filter_run_excluding :disabled => true end 7 describe "Ruby Hashes Part I" do 8 describe "array_2_hash" do 9 10 it "should be defined" do expect array_2 hash(["bobsmith@example.com", "sallyfield@example.com", "markdole@example.com"] Bob Smith': *', 'Sally Field', 'Mark Dole) ).not to raise_error 12 13 14 15 it "returns the correct hash [20 points]", points: 20 do 17 18 19 20 21 expect (array_2_hash ("bobsmith@example.com","sallyfield@example.com, "markdole@example.com"], {'Bob Smith':,., .Sally Field..", .Nark Dole''))).to be-a-kind-of Hash expect array_2_hash(["bobsmith@example.com", "sallyfield@example.com, "markdole@example.com, 'Bob Smith': '", 'Sally Field':'", Mark Dole")).to eq('Bob Smith':bobsmith@example.com', 'Sally Field': 'sallyfield@example.com Mark Dole: markdole@example.com) end 23 24 25 26 27 28 29 end 30 31 describe Ruby Hashes Part II do 32 it "works on the empty array [10 points]", points: 10 do expect array_2_hash(1, f'Bob Smith':, Sally Field':" 'Mark Dole':").not to raise_error expect (array_2_hash(, Bob Smith":'", 'Sally Field':", 'Mark Dole':)).to eq Bob Smith': 'Sally Field' 'Mark Dole':") end end describe "array2d_2_hash", :disabled true do it "should be defined" do 34 35 36 37 expect array2d_2_hash([[" bobsmith@example.com, "555-555-5555"],["sallyfield@example.com, "111-111-1111", Bob Smith: 'Sally Field).not to raise_error 44:7 Ruby Spaces: 2 + end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!