Class: String
Direct Known Subclasses
TaliaCore::DataTypes::FileStore::DataPath, TaliaCore::PropertyString
Instance Method Summary collapse
-
#no? ⇒ Boolean
(also: #false?)
Like #yes?, just checking for “no” or “false”.
-
#to_permalink ⇒ Object
Transform the current string into a permalink.
-
#to_uri ⇒ Object
Give a URI object created from the current string.
-
#yes? ⇒ Boolean
(also: #true?)
Returns true if the string is “yes” or “true”, regardless of capitalization and leading/trailing spaces.
Instance Method Details
#no? ⇒ Boolean Also known as: false?
Like #yes?, just checking for “no” or “false”
21 22 23 24 |
# File 'lib/core_ext/string.rb', line 21 def no? me = self.downcase.strip me == 'no' || me == 'false' end |
#to_permalink ⇒ Object
Transform the current string into a permalink.
3 4 5 |
# File 'lib/core_ext/string.rb', line 3 def to_permalink self.gsub(/\W+/, ' ').strip.downcase.titleize.gsub(/\ +/, '_') end |
#to_uri ⇒ Object
Give a URI object created from the current string
8 9 10 |
# File 'lib/core_ext/string.rb', line 8 def to_uri N::URI.new(self) end |
#yes? ⇒ Boolean Also known as: true?
Returns true if the string is “yes” or “true”, regardless of capitalization and leading/trailing spaces
14 15 16 17 |
# File 'lib/core_ext/string.rb', line 14 def yes? me = self.downcase.strip me == 'yes' || me == 'true' end |