Class: ImageCheckable

Inherits:
HTML::Proofer::Checkable show all
Defined in:
lib/html/proofer/checks/images.rb

Constant Summary collapse

SCREEN_SHOT_REGEX =
/Screen(?: |%20)Shot(?: |%20)\d+-\d+-\d+(?: |%20)at(?: |%20)\d+.\d+.\d+/

Constants included from HTML::Proofer::Utils

HTML::Proofer::Utils::STORAGE_DIR

Instance Attribute Summary collapse

Attributes inherited from HTML::Proofer::Checkable

#line

Instance Method Summary collapse

Methods inherited from HTML::Proofer::Checkable

#absolute_path, #allow_hash_href?, #exists?, #external?, #file_path, #follow_location?, #hash, #ignore?, #ignore_empty_alt?, #ignores_pattern_check, #initialize, #internal?, #non_http_remote?, #parts, #path, #remote?, #scheme, #unslashed_directory?, #url, #valid?

Methods included from HTML::Proofer::Utils

clean_content, create_nokogiri, #pluralize, swap

Constructor Details

This class inherits a constructor from HTML::Proofer::Checkable

Instance Attribute Details

#altObject (readonly)

Returns the value of attribute alt.



6
7
8
# File 'lib/html/proofer/checks/images.rb', line 6

def alt
  @alt
end

Instance Method Details

#empty_alt_tag?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/html/proofer/checks/images.rb', line 8

def empty_alt_tag?
  alt.strip.empty?
end

#missing_src?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/html/proofer/checks/images.rb', line 20

def missing_src?
  !src
end

#srcObject



16
17
18
# File 'lib/html/proofer/checks/images.rb', line 16

def src
  real_attr(@src) || real_attr(@srcset)
end

#terrible_filename?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/html/proofer/checks/images.rb', line 12

def terrible_filename?
  src =~ SCREEN_SHOT_REGEX
end