Module: Cms::Extensions::String
- Defined in:
- lib/cms/extensions/string.rb
Instance Method Summary collapse
Instance Method Details
#indent(n = 0) ⇒ Object
4 5 6 |
# File 'lib/cms/extensions/string.rb', line 4 def indent(n=0) (" "*n.to_i) + self end |
#markdown ⇒ Object
7 8 9 |
# File 'lib/cms/extensions/string.rb', line 7 def markdown Cms.markdown? ? Markdown.new(self).to_html : "<strong>ERROR</strong>: Markdown Support Not Installed" end |
#pluralize(count = nil) ⇒ Object
13 14 15 |
# File 'lib/cms/extensions/string.rb', line 13 def pluralize(count=nil) count == 1 ? self : ActiveSupport::Inflector.pluralize(self) end |
#to_slug ⇒ Object
10 11 12 |
# File 'lib/cms/extensions/string.rb', line 10 def to_slug gsub(/\W+/, ' ').strip.downcase.gsub(/\ +/, '-') end |