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.



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_nameObject (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

#callObject



12
13
14
15
16
# File 'lib/link_thumbnailer/graders/html_attribute.rb', line 12

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