Class: Nanoc::Extra::Checking::Check

Inherits:
Object
  • Object
show all
Extended by:
PluginRegistry::PluginMethods
Defined in:
lib/nanoc/extra/checking/check.rb

Direct Known Subclasses

Nanoc::Extra::Checking::Checks::CSS, Nanoc::Extra::Checking::Checks::ExternalLinks, Nanoc::Extra::Checking::Checks::HTML, Nanoc::Extra::Checking::Checks::InternalLinks, Nanoc::Extra::Checking::Checks::Stale

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods included from PluginRegistry::PluginMethods

all, identifier, identifiers, named, register

Constructor Details

- (Check) initialize(site)

Returns a new instance of Check



12
13
14
15
# File 'lib/nanoc/extra/checking/check.rb', line 12

def initialize(site)
  @site   = site
  @issues = Set.new
end

Instance Attribute Details

- (Object) issues (readonly)

Returns the value of attribute issues



10
11
12
# File 'lib/nanoc/extra/checking/check.rb', line 10

def issues
  @issues
end

- (Object) site (readonly)

Returns the value of attribute site



9
10
11
# File 'lib/nanoc/extra/checking/check.rb', line 9

def site
  @site
end

Instance Method Details

- (Object) add_issue(desc, params = {})



21
22
23
24
25
# File 'lib/nanoc/extra/checking/check.rb', line 21

def add_issue(desc, params = {})
  subject  = params.fetch(:subject, nil)

  @issues << Issue.new(desc, subject, self.class)
end

- (Object) output_filenames



27
28
29
# File 'lib/nanoc/extra/checking/check.rb', line 27

def output_filenames
  Dir[@site.config[:output_dir] + '/**/*'].select { |f| File.file?(f) }
end

- (Object) run

Raises:

  • (NotImplementedError)


17
18
19
# File 'lib/nanoc/extra/checking/check.rb', line 17

def run
  raise NotImplementedError.new('Nanoc::Extra::Checking::Check subclasses must implement #run')
end