Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create the following for the code below: 1)Write the Ruby code in this method that will return the contacts hash with emails populated from the

Create the following for the code below:

image text in transcribedimage text in transcribedimage text in transcribed

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:

image text in transcribed

require 'hashes.rb RSpec.configure do |configl config.filter_run_excluding :disabled => true end describe Ruby Hashes Part I' do describe "array_2_hash" do 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 end it "returns the correct hash [20 points]", points: 20 do expect (array_2_hash ("bobsmith@example.com", "sallyfield@example.com", "markdole@example . com"], {' Bob Smith' , .Sally Field': '', 'Mark Dole''))).to be-a-kind-of Hash expect (array_2_hash (["bobsmith@example.com", "sallyfield@example.com", "markdole@example.com"1, 'Bob Smith': '", 'Sally Field':" Mark Dole)to eq('Bob Smith': bobsmith@example.com, 'Sally Field': 'sallyfield@example.com, Mark Dole': 'markdole@example.com') end it "works on the empty array [10 points]", points: 10 do expect array_2_hash( 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 end describe Ruby Hashes Part II' do describe "array2d_2_hash", true do it "should be defined" do expect f array2d_2_hash([[ "bobsmith@example.com", "555-555-5555"], ["sallyfield@example.com", 111-111-1111 "]1, 'Bob Smith':, 'Sally Field) J.not_to raise_error 49:47 Ruby Spaces: 2 end require 'hashes.rb RSpec.configure do |configl config.filter_run_excluding :disabled => true end describe Ruby Hashes Part I' do describe "array_2_hash" do 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 end it "returns the correct hash [20 points]", points: 20 do expect (array_2_hash ("bobsmith@example.com", "sallyfield@example.com", "markdole@example . com"], {' Bob Smith' , .Sally Field': '', 'Mark Dole''))).to be-a-kind-of Hash expect (array_2_hash (["bobsmith@example.com", "sallyfield@example.com", "markdole@example.com"1, 'Bob Smith': '", 'Sally Field':" Mark Dole)to eq('Bob Smith': bobsmith@example.com, 'Sally Field': 'sallyfield@example.com, Mark Dole': 'markdole@example.com') end it "works on the empty array [10 points]", points: 10 do expect array_2_hash( 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 end describe Ruby Hashes Part II' do describe "array2d_2_hash", true do it "should be defined" do expect f array2d_2_hash([[ "bobsmith@example.com", "555-555-5555"], ["sallyfield@example.com", 111-111-1111 "]1, 'Bob Smith':, 'Sally Field) J.not_to raise_error 49:47 Ruby Spaces: 2 end

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Machine Performance Modeling Methodologies And Evaluation Strategies Lncs 257

Authors: Francesca Cesarini ,Silvio Salza

1st Edition

3540179429, 978-3540179429

More Books

Students also viewed these Databases questions

Question

Write justification/recommendation reports.

Answered: 1 week ago

Question

denigration of emotional outbursts; being reserved;

Answered: 1 week ago