Skip to content

Instantly share code, notes, and snippets.

@TorD
Created February 20, 2012 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save TorD/1869279 to your computer and use it in GitHub Desktop.
Save TorD/1869279 to your computer and use it in GitHub Desktop.
def get_field_type_for(label)
l = label.downcase
def l.contains?(words)
words.split(", ").any?{|word| self.include? word}
end
case
when l.contains?("merknad, notater, anmerkning") then "text"
when l.contains?("nr, tlf, telefon, nummer") then "number"
else
"string"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment