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-artirix-4.0.4 lib/cms/extensions/string.rb
browsercms-artirix-4.0.3.3 lib/cms/extensions/string.rb
browsercms-artirix-4.0.3.2 lib/cms/extensions/string.rb
browsercms-artirix-4.0.3.1 lib/cms/extensions/string.rb
browsercms-artirix-4.0.3 lib/cms/extensions/string.rb
browsercms-artirix-4.0.2 lib/cms/extensions/string.rb
browsercms-artirix-4.0.1.1 lib/cms/extensions/string.rb
browsercms-artirix-4.0.0.rc1.art4 lib/cms/extensions/string.rb
browsercms-4.0.0.rc1 lib/cms/extensions/string.rb
browsercms-4.0.0.beta lib/cms/extensions/string.rb
browsercms-4.0.0.alpha lib/cms/extensions/string.rb
browsercms-3.5.7 lib/cms/extensions/string.rb
browsercms-3.5.6 lib/cms/extensions/string.rb
browsercms-3.5.5 lib/cms/extensions/string.rb
browsercms-3.5.4 lib/cms/extensions/string.rb
browsercms-3.5.3 lib/cms/extensions/string.rb
browsercms-3.5.2 lib/cms/extensions/string.rb
browsercms-3.5.1 lib/cms/extensions/string.rb
browsercms-3.5.0 lib/cms/extensions/string.rb
browsercms-3.5.0.rc3 lib/cms/extensions/string.rb