Sha256: edc0b63f0f714438ac5a78d5d59b8d5c24d6224f56e0a0c3feee460c282c6f7a

Contents?: true

Size: 616 Bytes

Versions: 4

Compression:

Stored size: 616 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::Core::ViewContextForPreCompilation,
    ] => C::Any
    def apply_to(rep, site:, recorder:, view_context:)
      context = Nanoc::RuleDSL::CompilationRuleContext.new(
        rep:,
        recorder:,
        site:,
        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.13.3 lib/nanoc/rule_dsl/compilation_rule.rb
nanoc-4.13.2 lib/nanoc/rule_dsl/compilation_rule.rb
nanoc-4.13.1 lib/nanoc/rule_dsl/compilation_rule.rb
nanoc-4.13.0 lib/nanoc/rule_dsl/compilation_rule.rb