Sha256: df3b78ccc5a5e58f662d5584e52b9c3773200c5ce287273cc28b66709bcd98cf

Contents?: true

Size: 763 Bytes

Versions: 2

Compression:

Stored size: 763 Bytes

Contents

# frozen_string_literal: true

module Nanoc::Int
  # @api private
  # A dependency between two items/layouts.
  class Dependency
    include Nanoc::Int::ContractsSupport

    C_OBJ = C::Or[Nanoc::Int::Item, Nanoc::Int::Layout, Nanoc::Int::Configuration]

    contract C::None => C::Maybe[C_OBJ]
    attr_reader :from

    contract C::None => C::Maybe[C_OBJ]
    attr_reader :to

    contract C::None => Nanoc::Int::Props
    attr_reader :props

    contract C::Maybe[C_OBJ], C::Maybe[C_OBJ], Nanoc::Int::Props => C::Any
    def initialize(from, to, props)
      @from  = from
      @to    = to
      @props = props
    end

    contract C::None => String
    def inspect
      "Dependency(#{@from.inspect} -> #{@to.inspect}, #{@props.inspect})"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-4.7.12 lib/nanoc/base/entities/dependency.rb
nanoc-4.7.11 lib/nanoc/base/entities/dependency.rb