Module: CSD::Extensions::Core::String

Included in:
String
Defined in:
lib/csd/extensions/core/string.rb

Overview

This module comprises extensions to String objects.

Instance Method Summary collapse

Instance Method Details

#camelizeObject

See CSD::Vendor::ActiveSupport::Inflector#camelize



37
38
39
# File 'lib/csd/extensions/core/string.rb', line 37

def camelize
  Vendor::ActiveSupport::Inflector.camelize(self)
end

#constantizeObject

See CSD::Vendor::ActiveSupport::Inflector#constantize



31
32
33
# File 'lib/csd/extensions/core/string.rb', line 31

def constantize
  Vendor::ActiveSupport::Inflector.constantize(self)
end

#demodulizeObject

See CSD::Vendor::ActiveSupport::Inflector#demodulize



43
44
45
# File 'lib/csd/extensions/core/string.rb', line 43

def demodulize
  Vendor::ActiveSupport::Inflector.demodulize(self)
end

#ends_with?(*args) ⇒ Boolean

Just an alias to the more logical wording of this method

Returns:

  • (Boolean)


63
64
65
# File 'lib/csd/extensions/core/string.rb', line 63

def ends_with?(*args) #:nodoc:
  end_with?(*args)
end

#enquoteObject

Adds a double-quote to the beginning and the end of a String.

Example

'Hello World'.enquote    # => '`Hello World´'


19
20
21
# File 'lib/csd/extensions/core/string.rb', line 19

def enquote
  %Q{"#{self}"}
end

#hashedObject

Creates a SHA1 hash of the String object.



25
26
27
# File 'lib/csd/extensions/core/string.rb', line 25

def hashed
  Digest::SHA1.hexdigest self
end

#starts_with?(*args) ⇒ Boolean

Just an alias to the more logical wording of this method

Returns:

  • (Boolean)


57
58
59
# File 'lib/csd/extensions/core/string.rb', line 57

def starts_with?(*args) #:nodoc:
  start_with?(*args)
end

#underscorizeObject

See CSD::Vendor::ActiveSupport::Inflector#underscore. Note that there is a name conflict with String#underscore provided by CSD::Vendor::Term::ANSIColor, which is why this method is renamed to underscorize.



51
52
53
# File 'lib/csd/extensions/core/string.rb', line 51

def underscorize
  Vendor::ActiveSupport::Inflector.underscore(self)
end