ruby/import_js/importer.rb
def formatted_to_regex(string)
      # Based on
      # http://stackoverflow.com/questions/1509915/converting-camel-case-to-underscore-case-in-ruby
      string.
        gsub(/::/, '/'). # converts '::' to '/'
        gsub(/([a-z\d])([A-Z])/, '\1*\2'). # separates camelCase words with '*'
        tr('-_', '*'). # replaces underscores or dashes with '*'
        downcase # converts all upper to lower case
    end
# Takes a string in any of the following four formats:
#   dash-separated
#   snake_case
#   camelCase
#   PascalCase
# and turns it into a star-separated lower case format, like so:
#   star*separated
#
# @param string [String]
# @return [String]
Takes a string in any of the following four formats:
dash-separated
snake_case
camelCase
PascalCase
and turns it into a star-separated lower case format, like so:
star*separated
Takes a string in any of the following four formats : dash - separated snake_case camelCase PascalCase and turns it into a star - separated lower case format like so : star * separated
def formatted_to_regex(string)
      string.
        gsub(/::/, '/'). 
        gsub(/([a-z\d])([A-Z])/, '\1*\2'). 
        tr('-_', '*'). 
        downcase 
    end
def formatted_to_regex ( string ) string . gsub ( / :: / , '/' ) . gsub ( / ([a-z \d ])([A-Z]) / , '\1*\2' ) . tr ( '-_' , '*' ) . downcase end
Takes a string in any of the following four formats:
dash-separated
snake_case
camelCase
PascalCase
and turns it into a star-separated lower case format, like so:
star*separated
Takes a string in any of the following four formats : dash - separated snake_case camelCase PascalCase and turns it into a star - separated lower case format like so : star * separated
# Based on # http://stackoverflow.com/questions/1509915/converting-camel-case-to-underscore-case-in-ruby # converts '::' to '/' # separates camelCase words with '*' # replaces underscores or dashes with '*' # converts all upper to lower case
None
String
string
None