module Cucumber::Messages::Message::Utils::ClassMethods
def camelize(term)
https://github.com/rails/rails/blob/v6.1.3.2/activesupport/lib/active_support/inflector/methods.rb#L69
This is a simplified version of the Ruby on Rails implementation
camelize('gherkin_document') # => "GherkinDocument"
Converts strings to UpperCamelCase.
#
def camelize(term) camelized = term.to_s camelized.gsub!(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{$2.capitalize}" } camelized end
def underscore(term)
https://github.com/rails/rails/blob/v6.1.3.2/activesupport/lib/active_support/inflector/methods.rb#L92
This is a simplified version of the Ruby on Rails implementation
underscore('GherkinDocument') # => "gherkin_document"
Makes an underscored, lowercase form from the expression in the string.
#
def underscore(term) return term unless /[A-Z-]/.match?(term) word = term.gsub(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2') word.gsub!(/([a-z\d])([A-Z])/, '\1_\2') word.tr!("-", "_") word.downcase! word end