Sha256: 0a45f0f3a835753fd4adeccdecc0e18a99c409d3d7a4b93d46c8ad0eacb23ed3
Contents?: true
Size: 876 Bytes
Versions: 19
Compression:
Stored size: 876 Bytes
Contents
module LinkThumbnailer module Graders class HtmlAttribute < ::LinkThumbnailer::Graders::Base attr_reader :attribute_name def initialize(description, attribute_name) super(description) @attribute_name = attribute_name.to_sym end def call(current_score) return 0 unless attribute? score = 0 score -= 25 if negative? score += 25 if positive? score end private def attribute node[attribute_name] end def attribute? attribute && !attribute.empty? end def negative? attribute =~ negative_regex end def positive? attribute =~ positive_regex end def negative_regex config.negative_regex end def positive_regex config.positive_regex end end end end
Version data entries
19 entries across 19 versions & 1 rubygems