Hi, I have an array of strings:
["username", "String", "password", "String"]
And I want to convert this array to a list of Field objects:
class Field
attr_reader :name, :type
def initialize(name, type)
@name = name
@type = type
end
end
So I need to map "username", "String" => Field.new("username", "String") and so on. The length of the array will always be a multiple of two.
Does anyone know if this is possible using a map style method call?