Skip to content

Instantly share code, notes, and snippets.

@Mackaber
Created September 23, 2016 16:55
Show Gist options
  • Save Mackaber/cfcce4b0681e8fe592e655179c068799 to your computer and use it in GitHub Desktop.
Save Mackaber/cfcce4b0681e8fe592e655179c068799 to your computer and use it in GitHub Desktop.
Quick script for parsing the new_fields file
f = File.open("nuevos_campos.txt")
f.each_line do |line|
unless line == "\n"
text = line.chomp.split(",")
field_name = text[1].downcase.gsub(" ","_")
case text[2]
when "Select"
field_type = "numeric"
field_test = "`1`"
when "Numérico"
field_type = "numeric"
field_test = "`5`"
when "Alfanumérico"
field_type = "text"
field_test = "`0000`"
end
field_desc = text[0]
puts " + #{field_name} (required,#{field_type},#{field_test}) ... #{field_desc}."
else
puts "\n"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment