Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/qmin/core_ext/string.rb,
lib/qmin/core_ext/string.rb

Instance Method Summary collapse

Instance Method Details

#constantizeObject



12
13
14
# File 'lib/qmin/core_ext/string.rb', line 12

def constantize
  Kernel.const_get(self)
end

#to_queue_nameObject



20
21
22
# File 'lib/qmin/core_ext/string.rb', line 20

def to_queue_name
  gsub('::','').underscore
end

#underscoreObject



4
5
6
7
8
9
10
# File 'lib/qmin/core_ext/string.rb', line 4

def underscore
  self.to_s.gsub(/::/, '/').
    gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
    gsub(/([a-z\d])([A-Z])/,'\1_\2').
    tr('-', '_').
    downcase
end