Sha256: fbeeda4c005a73f496ef69b5577dd79692c588fdbc4c06ae68d42e1dfa1a7ba9
Contents?: true
Size: 797 Bytes
Versions: 27
Compression:
Stored size: 797 Bytes
Contents
module Decanter module Parser module Utils # extract string transformation strategies 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 def singular_class_present?(klass_or_sym) parser_str = singularize_and_camelize_str(klass_or_sym) concat_str(parser_str).safe_constantize.present? end def singularize_and_camelize_str(klass_or_sym) klass_or_sym.to_s.singularize.camelize end def camelize_str(klass_or_sym) klass_or_sym.to_s.camelize end def concat_str(parser_str) 'Decanter::Parser::'.concat(parser_str) end end end end
Version data entries
27 entries across 27 versions & 1 rubygems