lib/reality/naming.rb in reality-naming-1.5.0 vs lib/reality/naming.rb in reality-naming-1.6.0
- old
+ new
@@ -15,11 +15,11 @@
module Reality
module Naming
class << self
def camelize?(word)
- camelize(word) == word
+ camelize(word) == word.to_s
end
def camelize(input_word)
word_parts = split_into_words(input_word).collect { |part| part[0...1].upcase + part[1..-1] }
if word_parts.size > 0 && word_parts[0] == word_parts[0].upcase
@@ -28,44 +28,44 @@
word = word_parts.join('')
word[0...1].downcase + word[1..-1]
end
def pascal_case?(word)
- pascal_case(word) == word
+ pascal_case(word) == word.to_s
end
def pascal_case(word)
word_parts = split_into_words(word).collect { |part| part[0...1].upcase + part[1..-1] }
return word_parts[0] if (word_parts.size == 1 && word_parts[0] == word_parts[0].upcase)
word_parts.join('')
end
def underscore?(word)
- underscore(word) == word
+ underscore(word) == word.to_s
end
def underscore(input_word)
split_into_words(input_word).join('_').downcase
end
def xmlize?(word)
- xmlize(word) == word
+ xmlize(word) == word.to_s
end
def xmlize(word)
underscore(word).tr('_', '-')
end
def jsonize?(word)
- jsonize(word) == word
+ jsonize(word) == word.to_s
end
def jsonize(word)
camelize(word)
end
def uppercase_constantize?(word)
- uppercase_constantize(word) == word
+ uppercase_constantize(word) == word.to_s
end
def uppercase_constantize(word)
underscore(word).upcase
end