Class: Nanoc::Checking::DSL Private

Inherits:
Object
  • Object
show all
Defined in:
lib/nanoc/checking/dsl.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(enabled_checks:) ⇒ DSL

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of DSL.



14
15
16
# File 'lib/nanoc/checking/dsl.rb', line 14

def initialize(enabled_checks:)
  @enabled_checks = enabled_checks
end

Class Method Details

.from_file(filename, enabled_checks:) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



7
8
9
10
11
12
# File 'lib/nanoc/checking/dsl.rb', line 7

def self.from_file(filename, enabled_checks:)
  dsl = new(enabled_checks:)
  absolute_filename = File.expand_path(filename)
  dsl.instance_eval(File.read(filename), absolute_filename)
  dsl
end

Instance Method Details

#check(identifier) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



18
19
20
21
22
# File 'lib/nanoc/checking/dsl.rb', line 18

def check(identifier, &)
  klass = Class.new(::Nanoc::Checking::Check)
  klass.send(:define_method, :run, &)
  klass.send(:identifier, identifier)
end

#deploy_check(*identifiers) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



24
25
26
# File 'lib/nanoc/checking/dsl.rb', line 24

def deploy_check(*identifiers)
  identifiers.each { |i| @enabled_checks << i }
end