Sha256: 20bac6485e1d38676f82e67b3479aa82512229f5d410acfda7ed6609d98b6cc0

Contents?: true

Size: 764 Bytes

Versions: 34

Compression:

Stored size: 764 Bytes

Contents

module Cms
  module Extensions
    module String
      def indent(n=0)
        (" "*n.to_i) + self 
      end
      def markdown
        Cms.markdown? ? Markdown.new(self).to_html : "<strong>ERROR</strong>: Markdown Support Not Installed"   
      end 
      def to_slug
        gsub(/\W+/, ' ').strip.downcase.gsub(/\ +/, '-')
      end

      # Allows for conditional pluralization of names where object counts are not singular.
      #
      # @param [Integer] count The number of objects of this string there are.
      # @return [String] Plural of string, unless count == 1
      def pluralize_unless_one(count=nil)
        count == 1 ? self : ActiveSupport::Inflector.pluralize(self)
      end
    end
  end
end
String.send(:include, Cms::Extensions::String)

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
browsercms-3.5.0.rc2 lib/cms/extensions/string.rb
browsercms-3.5.0.rc1 lib/cms/extensions/string.rb
browsercms-3.4.2 lib/cms/extensions/string.rb
browsercms-3.3.4 lib/cms/extensions/string.rb
browsercms-3.4.2.rc1 lib/cms/extensions/string.rb
browsercms-3.4.1 lib/cms/extensions/string.rb
browsercms-3.4.0 lib/cms/extensions/string.rb
browsercms-3.4.0.rc2 lib/cms/extensions/string.rb
browsercms-3.4.0.rc1 lib/cms/extensions/string.rb
browsercms-3.3.3 lib/cms/extensions/string.rb
browsercms-3.3.2 lib/cms/extensions/string.rb
browsercms-3.3.1 lib/cms/extensions/string.rb
browsercms-3.3.0 lib/cms/extensions/string.rb
browsercms-3.3.0.beta lib/cms/extensions/string.rb