Sha256: 0bf9ae572713105955ea1bd34082a38931a10fd1e9ca66ed36fa93283b342bb6

Contents?: true

Size: 731 Bytes

Versions: 19

Compression:

Stored size: 731 Bytes

Contents

require 'delegate'
require 'link_thumbnailer/graders/base'
require 'link_thumbnailer/graders/length'
require 'link_thumbnailer/graders/html_attribute'
require 'link_thumbnailer/graders/link_density'
require 'link_thumbnailer/graders/position'

module LinkThumbnailer
  class Grader < ::SimpleDelegator

    attr_reader :config, :description

    def initialize(description)
      @config      = ::LinkThumbnailer.page.config
      @description = description

      super(config)
    end

    def call
      score = 0
      graders.each do |lambda|
        instance = lambda.call(description)
        score += instance.call(score)
      end

      score
    end

    private

    def graders
      config.graders
    end

  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

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