Module: QuickShoulda::StringHelpers

Included in:
QuickShoulda, PathResolver
Defined in:
lib/quick_shoulda/helpers/string_helpers.rb

Instance Method Summary collapse

Instance Method Details

#camelize(str) ⇒ Object



3
4
5
6
# File 'lib/quick_shoulda/helpers/string_helpers.rb', line 3

def camelize(str)
  return str if str !~ /_/ && str =~ /[A-Z]+.*/
  str.split("_").map{|e| e.capitalize}.join
end

#value_transform(value) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/quick_shoulda/helpers/string_helpers.rb', line 8

def value_transform(value)
  if value.is_a? String
    "('#{value}')"
  elsif value.is_a? Symbol
    "(:#{value})"
  else
    #fix for 1.8.7
    "(#{value.inspect})"
  end
end