class String

Constants

BLANK_RE

Public Instance Methods

blank?() click to toggle source

A string is blank if it's empty or contains whitespaces only:

''.blank?       # => true
'   '.blank?    # => true
"\t\n\r".blank? # => true
' blah '.blank? # => false

Unicode whitespace is supported:

"\u00a0".blank? # => true

@return [true, false]

# File lib/wedge/utilis/blank.rb, line 118
def blank?
  BLANK_RE === self
end
is_i?() click to toggle source
# File lib/wedge/utilis/element.rb, line 19
def is_i?
  self.to_i.to_s == self
end
titlecase(opts={})
Alias for: titleize
titlecase!()
Alias for: titleize!
titleize(opts={}) click to toggle source

Capitalizes most words to create a nicer looking title string.

The list of “small words” which are not capped comes from the New York Times Manual of Style, plus 'vs' and 'v'.

titleize is also aliased as titlecase.

"notes on a scandal" # => "Notes on a Scandal"
"the good german"    # => "The Good German"
# File lib/wedge/utilis/titleize.rb, line 83
def titleize(opts={})
  # if defined? ActiveSupport
  #   ActiveSupport::Inflector.titleize(self, opts)
  # else
    Titleize.titleize(self)
  # end
end
Also aliased as: titlecase
titleize!() click to toggle source
# File lib/wedge/utilis/titleize.rb, line 92
def titleize!
  replace(titleize)
end
Also aliased as: titlecase!