Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/locomotive/core_ext.rb
Overview
String
Instance Method Summary collapse
-
#permalink(underscore = false) ⇒ Object
:nodoc.
- #permalink!(underscore = false) ⇒ Object (also: #parameterize!)
Instance Method Details
#permalink(underscore = false) ⇒ Object
:nodoc
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/locomotive/core_ext.rb', line 7 def permalink(underscore = false) # if the slug includes one "_" at least, we consider that the "_" is used instead of "-". _permalink = if !self.index('_').nil? self.to_url(replace_whitespace_with: '_') else self.to_url end underscore ? _permalink.underscore : _permalink end |
#permalink!(underscore = false) ⇒ Object Also known as: parameterize!
18 19 20 |
# File 'lib/locomotive/core_ext.rb', line 18 def permalink!(underscore = false) replace(self.permalink(underscore)) end |