add more tests
This commit is contained in:
@@ -6,9 +6,8 @@ module Foreman::Helpers
|
||||
# classify('job-name') # => 'JobName'
|
||||
def classify(dashed_word)
|
||||
dashed_word.split('-').each { |part| part[0] = part[0].chr.upcase }.join
|
||||
end
|
||||
end # Tries to find a constant with the name specified in the argument string:
|
||||
|
||||
# Tries to find a constant with the name specified in the argument string:
|
||||
#
|
||||
# constantize("Module") # => Module
|
||||
# constantize("Test::Unit") # => Test::Unit
|
||||
@@ -28,10 +27,6 @@ module Foreman::Helpers
|
||||
def constantize(camel_cased_word)
|
||||
camel_cased_word = camel_cased_word.to_s
|
||||
|
||||
if camel_cased_word.include?('-')
|
||||
camel_cased_word = classify(camel_cased_word)
|
||||
end
|
||||
|
||||
names = camel_cased_word.split('::')
|
||||
names.shift if names.empty? || names.first.empty?
|
||||
|
||||
@@ -47,4 +42,4 @@ module Foreman::Helpers
|
||||
end
|
||||
constant
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user