Class: String
Instance Method Summary collapse
-
#blank? ⇒ Boolean
Return true if self has length 0 or is only whitespace, false otherwise.
-
#camelize ⇒ Object
Return a camel-case version of self, in contrast to underscore.
-
#underscore ⇒ Object
Return an underscore version of self, in contrast to camel-case.
Instance Method Details
#blank? ⇒ Boolean
Return true if self has length 0 or is only whitespace, false otherwise.
This is defined only if it is not yet defined.
20 21 22 |
# File 'lib/betterific/ruby_extensions.rb', line 20 def blank? self.strip.size == 0 end |
#camelize ⇒ Object
Return a camel-case version of self, in contrast to underscore.
This is defined only if it is not yet defined.
32 33 34 |
# File 'lib/betterific/ruby_extensions.rb', line 32 def camelize self.split('_').each(&:capitalize!).join end |
#underscore ⇒ Object
Return an underscore version of self, in contrast to camel-case.
This is defined only if it is not yet defined.
41 42 43 |
# File 'lib/betterific/ruby_extensions.rb', line 41 def underscore self.scan(/[A-Z][a-z]*/).join('_').downcase end |