class String
Public Instance Methods
permalink(underscore = false)
click to toggle source
# File lib/locomotive/common/core_ext/string.rb, line 18 def permalink(underscore = false) # if the slug includes one "_" at least, we consider that the "_" is used instead of "-". _permalink = if !index('_').nil? to_url(replace_whitespace_with: '_') else to_url end underscore ? _permalink.underscore : _permalink end
permalink!(underscore = false)
click to toggle source
# File lib/locomotive/common/core_ext/string.rb, line 29 def permalink!(underscore = false) replace(permalink(underscore)) end
Also aliased as: parameterize!
to_bool()
click to toggle source
# File lib/locomotive/common/core_ext/string.rb, line 5 def to_bool return true if self == true || self =~ (/(true|t|yes|y|1)$/i) return false if self == false || blank? || self =~ (/(false|f|no|n|0)$/i) raise ArgumentError, "invalid value for Boolean: \"#{self}\"" end