class String
Ruby’s core String
class. See documentation for version 2.1.5, 2.0.0, or 1.9.3.
Public Instance Methods
blank?()
click to toggle source
When called on a string, the #blank?
method returns true
if the string is empty or consists only of whitespace:
''.blank? # => true " \n ".blank? # => true 'foo'.blank? # => false
# File lib/reactive_support/core_ext/object/blank.rb 46 def blank? 47 !!(/\A[[:space:]]*\z/ =~ self) || self.empty? 48 end
present?()
click to toggle source
When called on a string, the #present?
method returns true
unless the string is empty or consists only of whitespace:
'foo'.present? # => true ''.present? # => false ' '.present? # => false
# File lib/reactive_support/core_ext/object/blank.rb 56 def present? 57 !blank? 58 end