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
-
#camelize ⇒ Object
See CSD::Vendor::ActiveSupport::Inflector#camelize.
-
#constantize ⇒ Object
See CSD::Vendor::ActiveSupport::Inflector#constantize.
-
#demodulize ⇒ Object
See CSD::Vendor::ActiveSupport::Inflector#demodulize.
-
#ends_with?(*args) ⇒ Boolean
Just an alias to the more logical wording of this method.
-
#enquote ⇒ Object
Adds a double-quote to the beginning and the end of a
String. -
#hashed ⇒ Object
Creates a SHA1 hash of the String object.
-
#starts_with?(*args) ⇒ Boolean
Just an alias to the more logical wording of this method.
-
#underscorize ⇒ Object
See CSD::Vendor::ActiveSupport::Inflector#underscore.
Instance Method Details
#camelize ⇒ Object
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 |
#constantize ⇒ Object
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 |
#demodulize ⇒ Object
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
63 64 65 |
# File 'lib/csd/extensions/core/string.rb', line 63 def ends_with?(*args) #:nodoc: end_with?(*args) end |
#enquote ⇒ Object
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 |
#hashed ⇒ Object
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
57 58 59 |
# File 'lib/csd/extensions/core/string.rb', line 57 def starts_with?(*args) #:nodoc: start_with?(*args) end |
#underscorize ⇒ Object
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 |