Question
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:
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:
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started