Sha256: d23cbe147b0cde02603173168716c81893f2c0d4580e24216ed7f693924753db

Contents?: true

Size: 641 Bytes

Versions: 7

Compression:

Stored size: 641 Bytes

Contents

# frozen_string_literal: true

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

    contract Nanoc::Core::ItemRep, C::KeywordArgs[
      site: Nanoc::Core::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

7 entries across 7 versions & 1 rubygems

Version Path
nanoc-4.11.11 lib/nanoc/rule_dsl/compilation_rule.rb
nanoc-4.11.10 lib/nanoc/rule_dsl/compilation_rule.rb
nanoc-4.11.9 lib/nanoc/rule_dsl/compilation_rule.rb
nanoc-4.11.8 lib/nanoc/rule_dsl/compilation_rule.rb
nanoc-4.11.7 lib/nanoc/rule_dsl/compilation_rule.rb
nanoc-4.11.6 lib/nanoc/rule_dsl/compilation_rule.rb
nanoc-4.11.5 lib/nanoc/rule_dsl/compilation_rule.rb