Sha256: 46fa077c78e4d00545ffe4128b48f4c2bf65b4576b60e9aa8832a9ae9ba5b6d4

Contents?: true

Size: 640 Bytes

Versions: 4

Compression:

Stored size: 640 Bytes

Contents

# frozen_string_literal: true

module Nanoc::RuleDSL
  class CompilationRule < Rule
    include Nanoc::Core::ContractsSupport

    contract Nanoc::Core::ItemRep, C::KeywordArgs[
      site: Nanoc::Int::Site,
      recorder: Nanoc::RuleDSL::ActionRecorder,
      view_context: Nanoc::ViewContextForPreCompilation,
    ] => C::Any
    def apply_to(rep, site:, recorder:, view_context:)
      context = Nanoc::RuleDSL::CompilationRuleContext.new(
        rep: rep,
        recorder: recorder,
        site: site,
        view_context: view_context,
      )

      context.instance_exec(matches(rep.item.identifier), &@block)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nanoc-4.11.4 lib/nanoc/rule_dsl/compilation_rule.rb
nanoc-4.11.3 lib/nanoc/rule_dsl/compilation_rule.rb
nanoc-4.11.2 lib/nanoc/rule_dsl/compilation_rule.rb
nanoc-4.11.1 lib/nanoc/rule_dsl/compilation_rule.rb