class String

@see String

Public Instance Methods

camelize() click to toggle source

converts an underscored string to a camelized one @return String

# File lib/fqdn_facts/core_ext.rb, line 73
def camelize
  split('_').collect(&:capitalize).join
end
constantize(base = Object) click to toggle source

Attempts to transform string into a class constant

# File lib/fqdn_facts/core_ext.rb, line 78
def constantize(base = Object)
  split('/')
    .collect(&:camelize)
    .inject(base) { |obj, klass| obj.const_get(klass) }
end
empty?() click to toggle source
# File lib/fqdn_facts/core_ext.rb, line 61
def empty?
  !!(self !~ /\S/)
end
underscore() click to toggle source

converts a camelized string to underscored @return String

# File lib/fqdn_facts/core_ext.rb, line 67
def underscore
  split(/([A-Z][a-z0-9]+)/).reject(&:empty?).collect(&:downcase).join('_')
end