module Decanter::Parser::Utils

Public Instance Methods

camelize_str(klass_or_sym) click to toggle source
# File lib/decanter/parser/utils.rb, line 22
def camelize_str(klass_or_sym)
  klass_or_sym.to_s.camelize
end
concat_str(parser_str) click to toggle source
# File lib/decanter/parser/utils.rb, line 26
def concat_str(parser_str)
  'Decanter::Parser::'.concat(parser_str)
end
singular_class_present?(klass_or_sym) click to toggle source
# File lib/decanter/parser/utils.rb, line 13
def singular_class_present?(klass_or_sym)
  parser_str = singularize_and_camelize_str(klass_or_sym)
  concat_str(parser_str).safe_constantize.present?
end
singularize_and_camelize_str(klass_or_sym) click to toggle source
# File lib/decanter/parser/utils.rb, line 18
def singularize_and_camelize_str(klass_or_sym)
  klass_or_sym.to_s.singularize.camelize
end
symbol_to_string(klass_or_sym) click to toggle source

extract string transformation strategies

# File lib/decanter/parser/utils.rb, line 5
def symbol_to_string(klass_or_sym)
  if singular_class_present?(klass_or_sym)
    singularize_and_camelize_str(klass_or_sym)
  else
    camelize_str(klass_or_sym)
  end
end