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+/

Instance Attribute Summary

Attributes inherited from HTML::Proofer::Checkable

#line

Instance Method Summary collapse

Methods inherited from HTML::Proofer::Checkable

#absolute_path, #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::Utils

create_nokogiri, swap

Constructor Details

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

Instance Method Details

#altObject



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

def alt
  @alt
end

#empty_alt_tag?Boolean

Returns:

  • (Boolean)


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

def empty_alt_tag?
  alt.strip.empty?
end

#missing_src?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/html/proofer/checks/images.rb', line 23

def missing_src?
  !src
end

#srcObject



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

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

#terrible_filename?Boolean

Returns:

  • (Boolean)


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

def terrible_filename?
  src =~ SCREEN_SHOT_REGEX
end