Sha256: b529d3c89c5c69e0f54311641261328cfdb4bddbd5e939a6767fde400e37c628

Contents?: true

Size: 854 Bytes

Versions: 38

Compression:

Stored size: 854 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_FROM = C::Or[Nanoc::Int::Item, Nanoc::Int::Layout, Nanoc::Int::Configuration, Nanoc::Int::IdentifiableCollection]
    C_OBJ_TO   = Nanoc::Int::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

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
nanoc-4.8.15 lib/nanoc/base/entities/dependency.rb
nanoc-4.8.14 lib/nanoc/base/entities/dependency.rb
nanoc-4.8.13 lib/nanoc/base/entities/dependency.rb
nanoc-4.8.12 lib/nanoc/base/entities/dependency.rb
nanoc-4.8.11 lib/nanoc/base/entities/dependency.rb
nanoc-4.8.10 lib/nanoc/base/entities/dependency.rb
nanoc-4.8.9 lib/nanoc/base/entities/dependency.rb
nanoc-4.8.8 lib/nanoc/base/entities/dependency.rb
nanoc-4.8.7 lib/nanoc/base/entities/dependency.rb
nanoc-4.8.6 lib/nanoc/base/entities/dependency.rb
nanoc-4.8.5 lib/nanoc/base/entities/dependency.rb
nanoc-4.8.4 lib/nanoc/base/entities/dependency.rb
nanoc-4.8.3 lib/nanoc/base/entities/dependency.rb
nanoc-4.8.2 lib/nanoc/base/entities/dependency.rb
nanoc-4.8.1 lib/nanoc/base/entities/dependency.rb
nanoc-4.8.0 lib/nanoc/base/entities/dependency.rb
nanoc-4.7.14 lib/nanoc/base/entities/dependency.rb
nanoc-4.7.13 lib/nanoc/base/entities/dependency.rb