Sha256: 25cc3b566419b19a418c6fc1cdfb385cd5c6c8c16e905f78a9776851bc982d95
Contents?: true
Size: 1002 Bytes
Versions: 1
Compression:
Stored size: 1002 Bytes
Contents
# typed: true # frozen_string_literal: true module Packwerk class Package include Comparable ROOT_PACKAGE_NAME = "." attr_reader :name, :dependencies def initialize(name:, config:) @name = name @config = config || {} @dependencies = Array(@config["dependencies"]).freeze end def enforce_privacy @config["enforce_privacy"] end def enforce_dependencies? @config["enforce_dependencies"] == true end def dependency?(package) @dependencies.include?(package.name) end def package_path?(path) return true if root? path.start_with?(@name) end def public_path @public_path ||= File.join(@name, "app/public/") end def public_path?(path) path.start_with?(public_path) end def <=>(other) return nil unless other.is_a?(self.class) name <=> other.name end def to_s name end def root? @name == ROOT_PACKAGE_NAME end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
packwerk-1.0.0 | lib/packwerk/package.rb |