Class: PackageProtections::Private::Configuration

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/package_protections/private/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



18
19
20
21
22
# File 'lib/package_protections/private/configuration.rb', line 18

def initialize
  @protections = T.let(default_protections, T::Array[ProtectionInterface])
  @globally_permitted_namespaces = T.let([], T::Array[String])
  @acceptable_parent_classes = T.let([], T::Array[String])
end

Instance Attribute Details

#acceptable_parent_classesObject

Returns the value of attribute acceptable_parent_classes.



15
16
17
# File 'lib/package_protections/private/configuration.rb', line 15

def acceptable_parent_classes
  @acceptable_parent_classes
end

#globally_permitted_namespacesObject

Returns the value of attribute globally_permitted_namespaces.



12
13
14
# File 'lib/package_protections/private/configuration.rb', line 12

def globally_permitted_namespaces
  @globally_permitted_namespaces
end

#protectionsObject

Returns the value of attribute protections.



9
10
11
# File 'lib/package_protections/private/configuration.rb', line 9

def protections
  @protections
end

Instance Method Details

#bust_cache!Object



24
25
26
27
28
# File 'lib/package_protections/private/configuration.rb', line 24

def bust_cache!
  @protections = default_protections
  @globally_permitted_namespaces = []
  @acceptable_parent_classes = []
end

#default_protectionsObject



31
32
33
34
35
36
37
38
39
40
# File 'lib/package_protections/private/configuration.rb', line 31

def default_protections
  [
    Private::OutgoingDependencyProtection.new,
    Private::IncomingPrivacyProtection.new,
    RuboCop::Cop::PackageProtections::TypedPublicApi.new,
    RuboCop::Cop::PackageProtections::NamespacedUnderPackageName.new,
    RuboCop::Cop::PackageProtections::OnlyClassMethods.new,
    RuboCop::Cop::PackageProtections::RequireDocumentedPublicApis.new
  ]
end