Class: RubyQt6::QtCore::Private::Inflector

Inherits:
Object
  • Object
show all
Defined in:
lib/qt6/qtcore/private/inflector.rb

Instance Method Summary collapse

Instance Method Details

#camelize(str) ⇒ Object



7
8
9
10
11
# File 'lib/qt6/qtcore/private/inflector.rb', line 7

def camelize(str)
  str = str.dup
  str.gsub!(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{$2.capitalize}" }
  str
end

#underscore(str) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/qt6/qtcore/private/inflector.rb', line 13

def underscore(str)
  str = str.dup
  str.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2')
  str.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
  str.downcase!
  str
end