Sha256: 93c9bf391abf01816735e67a65dbcc4ca2ebd51dc5ad2c4732a595854262fa02

Contents?: true

Size: 590 Bytes

Versions: 11

Compression:

Stored size: 590 Bytes

Contents

module Relevance
  module CoreExtensions
    module Nil
      def ellipsize(cutoff = 20)
        ""
      end
    end

    module String
      def ellipsize(cutoff = 20)
        if length > cutoff
          "#{self[0...cutoff]}..."
        else
          self
        end
      end
    end

    module Object
      def ellipsize(cutoff = 20)
        inspect.ellipsize(cutoff)
      end
    end
  end
end

class Object
  include Relevance::CoreExtensions::Object
end
class String
  include Relevance::CoreExtensions::String
end
class NilClass
  include Relevance::CoreExtensions::Nil
end



Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
codez-tarantula-0.5.5 lib/relevance/core_extensions/ellipsize.rb
codez-tarantula-0.5.4 lib/relevance/core_extensions/ellipsize.rb
codez-tarantula-0.5.3 lib/relevance/core_extensions/ellipsize.rb
codez-tarantula-0.5.1 lib/relevance/core_extensions/ellipsize.rb
codez-tarantula-0.5.0 lib/relevance/core_extensions/ellipsize.rb
tarantula-0.5.1 lib/relevance/core_extensions/ellipsize.rb
tarantula-0.5.0 lib/relevance/core_extensions/ellipsize.rb
tarantula-0.4.3 lib/relevance/core_extensions/ellipsize.rb
tarantula-0.4.2 lib/relevance/core_extensions/ellipsize.rb
tarantula-0.4.1 lib/relevance/core_extensions/ellipsize.rb
tarantula-0.4.0 lib/relevance/core_extensions/ellipsize.rb