lib/tr8n/tokenized_label.rb in tr8n-3.1.8 vs lib/tr8n/tokenized_label.rb in tr8n-3.2.0
- old
+ new
@@ -1,7 +1,7 @@
#--
-# Copyright (c) 2010-2011 Michael Berkovich
+# Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
@@ -61,11 +61,11 @@
hash[token.sanitized_name] = token
end
hash
end
end
-
+
def tokens?
tokens.any?
end
# tokens that can be used by the user in translation
@@ -121,19 +121,9 @@
clean_label.split(" ").each do |w|
parts << w.strip.capitalize if w.length > 3
end
parts
- end
- end
-
- def sanitized_tokens_hash
- @sanitized_tokens_hash ||= begin
- hash = {}
- tokens.each do |token|
- hash[token.sanitized_name] = token
- end
- hash
end
end
def allowed_token?(token)
not sanitized_tokens_hash[token.sanitized_name].nil?