Sha256: ca37db3aa01a8d0c6b62f23478d71f1c18f74dee5055ed2d33ee2d7cc470158c
Contents?: true
Size: 711 Bytes
Versions: 17
Compression:
Stored size: 711 Bytes
Contents
# frozen_string_literal: true module Nanoc::RuleDSL class Rule include Nanoc::Int::ContractsSupport contract C::None => Symbol attr_reader :rep_name contract C::None => Nanoc::Int::Pattern attr_reader :pattern contract Nanoc::Int::Pattern, Symbol, Proc => C::Any def initialize(pattern, rep_name, block) @pattern = pattern @rep_name = rep_name.to_sym @block = block end contract Nanoc::Int::Item => C::Bool def applicable_to?(item) @pattern.match?(item.identifier) end # @api private contract Nanoc::Identifier => C::Or[nil, C::ArrayOf[String]] def matches(identifier) @pattern.captures(identifier) end end end
Version data entries
17 entries across 17 versions & 1 rubygems