rubypage-object-gem

array of values from page-object elements


is there a better way to get an array of the elements values than the following

    descriptions = []
     page.file_descriptions_elements.each do |row|
       descriptions.push(row.value)
     end 

Solution

  • You could use Enumerable#map to reduce the code:

    page.file_descriptions_elements.map(&:value)