Sha256: 544d5bf39b7e4262c904f1245729fb15298afb3ac678954c73a76811f19a4f89

Contents?: true

Size: 920 Bytes

Versions: 4

Compression:

Stored size: 920 Bytes

Contents

# frozen_string_literal: true

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

      C_OBJ_FROM = C::Or[Nanoc::Core::Item, Nanoc::Core::Layout, Nanoc::Core::Configuration, Nanoc::Core::IdentifiableCollection]
      C_OBJ_TO   = Nanoc::Core::Item

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

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

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

      contract C::Maybe[C_OBJ_FROM], C::Maybe[C_OBJ_TO], 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
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nanoc-4.11.4 lib/nanoc/base/entities/dependency.rb
nanoc-4.11.3 lib/nanoc/base/entities/dependency.rb
nanoc-4.11.2 lib/nanoc/base/entities/dependency.rb
nanoc-4.11.1 lib/nanoc/base/entities/dependency.rb