Sha256: 44e624978a296e5cdf351a8516b4d95284b08188d0b18773a6e7d493acc93602

Contents?: true

Size: 625 Bytes

Versions: 22

Compression:

Stored size: 625 Bytes

Contents

# frozen_string_literal: true

require_relative 'short_string'

module Dsu
  module Support
    module Descriptable
      class << self
        def included(base)
          base.extend(ClassMethods)
        end
      end

      def short_description
        return '' if description.blank?

        self.class.short_description(string: description)
      end

      module ClassMethods
        include ShortString

        def short_description(string:, count: ShortString::SHORT_STRING_MAX_COUNT, elipsis: '...')
          short_string(string: string, count: count, elipsis: elipsis)
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
dsu-3.0.5 lib/dsu/support/descriptable.rb
dsu-3.0.4 lib/dsu/support/descriptable.rb
dsu-3.0.3 lib/dsu/support/descriptable.rb
dsu-3.0.1 lib/dsu/support/descriptable.rb
dsu-3.0.0 lib/dsu/support/descriptable.rb
dsu-3.0.0.beta.3 lib/dsu/support/descriptable.rb
dsu-3.0.0.beta.2 lib/dsu/support/descriptable.rb
dsu-3.0.0.beta.1 lib/dsu/support/descriptable.rb
dsu-3.0.0.beta.0 lib/dsu/support/descriptable.rb
dsu-3.0.0.alpha.12 lib/dsu/support/descriptable.rb
dsu-3.0.0.alpha.11 lib/dsu/support/descriptable.rb
dsu-3.0.0.alpha.10 lib/dsu/support/descriptable.rb
dsu-3.0.0.alpha.9 lib/dsu/support/descriptable.rb
dsu-3.0.0.alpha.8 lib/dsu/support/descriptable.rb
dsu-3.0.0.alpha.7 lib/dsu/support/descriptable.rb
dsu-3.0.0.alpha.6 lib/dsu/support/descriptable.rb
dsu-3.0.0.alpha.5 lib/dsu/support/descriptable.rb
dsu-3.0.0.alpha.4 lib/dsu/support/descriptable.rb
dsu-3.0.0.alpha.3 lib/dsu/support/descriptable.rb
dsu-3.0.0.alpha.2 lib/dsu/support/descriptable.rb