Created
November 25, 2008 16:39
-
-
Save karmi/28974 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| locales = ["cz", "en"] | |
| %w{name name_cz name_is_long name_is_long_cz name123_cz name_en name_ane name_es}.each do |attribute_name| | |
| if includes_locale = locales.find { |locale| attribute_name =~ Regexp.new("_#{locale}$") } | |
| puts includes_locale.inspect | |
| puts attribute_name + ' : true' | |
| puts "Attribute name without locale is " + attribute_name.sub( Regexp.new("(\w*)_#{includes_locale}$"), '\1' ) | |
| puts "---" | |
| else | |
| puts attribute_name + ' : false' | |
| puts "---" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment