Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/core_ext/string.rb
Direct Known Subclasses
TaliaCore::DataTypes::FileStore::DataPath, TaliaCore::PropertyString
Instance Method Summary collapse
-
#to_permalink ⇒ Object
Transform the current string into a permalink.
-
#to_uri ⇒ Object
Give a URI object created from the current string.
Instance Method Details
#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 |