Created
September 23, 2016 16:55
-
-
Save Mackaber/cfcce4b0681e8fe592e655179c068799 to your computer and use it in GitHub Desktop.
Quick script for parsing the new_fields file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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