class Nanoc::Checking::DSL

@api private

Public Class Methods

from_file(filename, enabled_checks:) click to toggle source
# File lib/nanoc/checking/dsl.rb, line 7
def self.from_file(filename, enabled_checks:)
  dsl = new(enabled_checks: enabled_checks)
  absolute_filename = File.expand_path(filename)
  dsl.instance_eval(File.read(filename), absolute_filename)
  dsl
end
new(enabled_checks:) click to toggle source
# File lib/nanoc/checking/dsl.rb, line 14
def initialize(enabled_checks:)
  @enabled_checks = enabled_checks
end

Public Instance Methods

check(identifier, &block) click to toggle source
# File lib/nanoc/checking/dsl.rb, line 18
def check(identifier, &block)
  klass = Class.new(::Nanoc::Checking::Check)
  klass.send(:define_method, :run, &block)
  klass.send(:identifier, identifier)
end
deploy_check(*identifiers) click to toggle source
# File lib/nanoc/checking/dsl.rb, line 24
def deploy_check(*identifiers)
  identifiers.each { |i| @enabled_checks << i }
end