Class: LinkThumbnailer::Graders::HtmlAttribute
- Defined in:
- lib/link_thumbnailer/graders/html_attribute.rb
Instance Attribute Summary collapse
-
#attribute_name ⇒ Object
readonly
Returns the value of attribute attribute_name.
Attributes inherited from Base
Instance Method Summary collapse
- #call(current_score) ⇒ Object
-
#initialize(description, attribute_name) ⇒ HtmlAttribute
constructor
A new instance of HtmlAttribute.
Constructor Details
#initialize(description, attribute_name) ⇒ HtmlAttribute
Returns a new instance of HtmlAttribute.
7 8 9 10 |
# File 'lib/link_thumbnailer/graders/html_attribute.rb', line 7 def initialize(description, attribute_name) super(description) @attribute_name = attribute_name.to_sym end |
Instance Attribute Details
#attribute_name ⇒ Object (readonly)
Returns the value of attribute attribute_name.
5 6 7 |
# File 'lib/link_thumbnailer/graders/html_attribute.rb', line 5 def attribute_name @attribute_name end |
Instance Method Details
#call(current_score) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/link_thumbnailer/graders/html_attribute.rb', line 12 def call(current_score) return 0 unless attribute? score = 0 score -= 25 if negative? score += 25 if positive? score end |