Sha256: a1e95e2cb40b2b327e19bd982ad1b2f2dfdf93dffb4cba5d297074adea504728

Contents?: true

Size: 831 Bytes

Versions: 1

Compression:

Stored size: 831 Bytes

Contents

# frozen_string_literal: true

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

    contract C::None => C::Maybe[C::Or[Nanoc::Int::Item, Nanoc::Int::Layout]]
    attr_reader :from

    contract C::None => C::Maybe[C::Or[Nanoc::Int::Item, Nanoc::Int::Layout]]
    attr_reader :to

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

    contract C::Maybe[C::Or[Nanoc::Int::Item, Nanoc::Int::Layout]], C::Maybe[C::Or[Nanoc::Int::Item, Nanoc::Int::Layout]], 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

1 entries across 1 versions & 1 rubygems

Version Path
nanoc-4.7.10 lib/nanoc/base/entities/dependency.rb