Re: [Rails] Can you plz, explain to me part of this code ?

2018-04-30 Thread Abdel Latif
Thank you Rob, I appreciate your help, good explanation. On Thu, Apr 26, 2018 at 5:02 PM, Rob Biedenharn <rob.biedenh...@gmail.com> wrote: > > > On 2018-Apr-26, at 13:47 , Abdel Latif <mlotfi2...@gmail.com> wrote: > > But [["AB_1020", "AB_950"

Re: [Rails] Can you plz, explain to me part of this code ?

2018-04-26 Thread Abdel Latif
But [["AB_1020", "AB_950", "AB_50"], ["1000", "570"]] has non numerical values too. On Thursday, April 26, 2018 at 1:05:53 PM UTC-4, Walter Lee Davis wrote: > > > > On Apr 26, 2018, at 12:12 PM, Abdel Latif <mlotf...@gmail.com

[Rails] Can you plz, explain to me part of this code ?

2018-04-26 Thread Abdel Latif
Hi, I found this code for sorting an array : p ["AB_1020", "AB_950", "AB_50", "1000", "570"].partition{|x| x.to_i.zero? } .flat_map{|x| x.sort_by {|x|x[/d+/]}.reverse} ouptut #⇒ ["AB_50", "AB_950", "AB_1020", "570", "1000"] I know that .partition{|x| x.to_i.zero? } will create an

[Rails] click on links from an array

2018-04-19 Thread Abdel Latif
HI, I have an array that has hrefs : arr=["https://demo.massbrc.com/applicants/57/applicant_identity_documents/new;, "https://demo.massbrc.com/applicants/47/applicant_identity_documents/new;] arr.each do |link| driver.find_element(xpath: "//*[@href='#{link}']").click

[Rails] Compare hashes and report where the change was

2018-04-09 Thread Abdel Latif
Hi, I would like to compare two hashes, for example: array1 = [{'id' => 124, 'name' => 'Kamal', 'job' => 'manager'},{'id' => 314, 'name' => 'John', 'job' => 'developer'}] array2 = [{'id' => 124, 'name' => 'Kamal', 'job' => 'managerZ'},{'id' => 314, 'name' => 'JohnDD', 'job' => 'developer'}]

[Rails] how to find that array include only some multiple values ? ruby

2018-02-26 Thread Abdel Latif
Hi, I would like to find a way to tell me if an array has only some items but not others, for example : employment_status = ['Hired','Hired','Provisionally Hired','Hired','Hired','Provisionally Hired','Hired','Provisionally Hired','Hired'] I want to test this array to see if it contains only