Class: LinkThumbnailer::Graders::HtmlAttribute

Inherits:
Base
  • Object
show all
Defined in:
lib/link_thumbnailer/graders/html_attribute.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#config, #description, #options

Instance Method Summary collapse

Methods inherited from Base

#weight

Constructor Details

#initialize(description, attribute_name) ⇒ HtmlAttribute

Returns a new instance of HtmlAttribute.



9
10
11
12
# File 'lib/link_thumbnailer/graders/html_attribute.rb', line 9

def initialize(description, attribute_name)
  super(description)
  @attribute_name = attribute_name.to_sym
end

Instance Attribute Details

#attribute_nameObject (readonly)

Returns the value of attribute attribute_name.



7
8
9
# File 'lib/link_thumbnailer/graders/html_attribute.rb', line 7

def attribute_name
  @attribute_name
end

Instance Method Details

#callObject



14
15
16
17
18
# File 'lib/link_thumbnailer/graders/html_attribute.rb', line 14

def call
  return 1.0 if positive?
  return 0.0 if negative?
  1.0
end