Sha256: 4eb34acce151dc7047bfab18ae8f3b8c6e1eff9f1d1b983e1cfd14629edcf3a0

Contents?: true

Size: 340 Bytes

Versions: 19

Compression:

Stored size: 340 Bytes

Contents

module LinkThumbnailer
  module Graders
    class Length < ::LinkThumbnailer::Graders::Base

      def call(current_score)
        return -Float::INFINITY if too_short?

        [(text.length / 100).to_i, 3].min
      end

      private

      def too_short?
        text.length < config.description_min_length
      end

    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
link_thumbnailer-2.6.1 lib/link_thumbnailer/graders/length.rb
link_thumbnailer-2.6.0 lib/link_thumbnailer/graders/length.rb
link_thumbnailer-2.5.2 lib/link_thumbnailer/graders/length.rb
link_thumbnailer-2.5.1 lib/link_thumbnailer/graders/length.rb
link_thumbnailer-2.5.0 lib/link_thumbnailer/graders/length.rb
link_thumbnailer-2.4.0 lib/link_thumbnailer/graders/length.rb
link_thumbnailer-2.3.2 lib/link_thumbnailer/graders/length.rb
link_thumbnailer-2.3.1 lib/link_thumbnailer/graders/length.rb
link_thumbnailer-2.3.0 lib/link_thumbnailer/graders/length.rb
link_thumbnailer-2.2.3 lib/link_thumbnailer/graders/length.rb
link_thumbnailer-2.2.2 lib/link_thumbnailer/graders/length.rb
link_thumbnailer-2.2.1 lib/link_thumbnailer/graders/length.rb
link_thumbnailer-2.2.0 lib/link_thumbnailer/graders/length.rb
link_thumbnailer-2.1.0 lib/link_thumbnailer/graders/length.rb
link_thumbnailer-2.0.4 lib/link_thumbnailer/graders/length.rb
link_thumbnailer-2.0.3 lib/link_thumbnailer/graders/length.rb
link_thumbnailer-2.0.2 lib/link_thumbnailer/graders/length.rb
link_thumbnailer-2.0.1 lib/link_thumbnailer/graders/length.rb
link_thumbnailer-2.0.0 lib/link_thumbnailer/graders/length.rb