Class: Image

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 Method Summary collapse

Methods inherited from HTML::Proofer::Checkable

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

Constructor Details

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

Instance Method Details

#missing_src?Boolean

Returns:

  • (Boolean)


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

def missing_src?
  !src
end

#srcObject



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

def src
  @src unless @src.nil? || @src.empty?
end

#terrible_filename?Boolean

Returns:

  • (Boolean)


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

def terrible_filename?
  @src =~ SCREEN_SHOT_REGEX
end

#valid_alt_tag?Boolean

Returns:

  • (Boolean)


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

def valid_alt_tag?
  @alt and !@alt.empty?
end