Sha256: d644e489e3ff5690177635bdee92b5b5b2007c0b3e6b5e3302e5877a17c6d893

Contents?: true

Size: 640 Bytes

Versions: 1

Compression:

Stored size: 640 Bytes

Contents

class String
  # Transform the current string into a permalink.
  def to_permalink
    self.gsub(/\W+/, ' ').strip.downcase.titleize.gsub(/\ +/, '_')
  end
  
  # Give a URI object created from the current string
  def to_uri
    N::URI.new(self)
  end
  
  # Returns true if the string is "yes" or "true", regardless
  # of capitalization and leading/trailing spaces
  def yes?
    me = self.downcase.strip
    me == 'yes' || me == 'true'
  end
  alias_method :true?, :yes?
  
  # Like #yes?, just checking for "no" or "false"
  def no?
    me = self.downcase.strip
    me == 'no' || me == 'false'
  end
  alias_method :false?, :no?
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
talia_core-0.7.0 lib/core_ext/string.rb