Class: Mudguard::Domain::Dependency

Inherits:
Object
  • Object
show all
Defined in:
lib/mudguard/domain/dependency.rb

Overview

A Dependency between Modules

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dependency:, location: nil) ⇒ Dependency

Returns a new instance of Dependency.



9
10
11
12
# File 'lib/mudguard/domain/dependency.rb', line 9

def initialize(dependency:, location: nil)
  @location = location
  @dependency = dependency
end

Instance Attribute Details

#dependencyObject (readonly)

Returns the value of attribute dependency.



7
8
9
# File 'lib/mudguard/domain/dependency.rb', line 7

def dependency
  @dependency
end

#locationObject (readonly)

Returns the value of attribute location.



7
8
9
# File 'lib/mudguard/domain/dependency.rb', line 7

def location
  @location
end

Instance Method Details

#==(other) ⇒ Object



22
23
24
25
# File 'lib/mudguard/domain/dependency.rb', line 22

def ==(other)
  @location == other.instance_eval { @location } &&
    @dependency == other.instance_eval { @dependency }
end

#inspectObject



14
15
16
# File 'lib/mudguard/domain/dependency.rb', line 14

def inspect
  "{#{@location}, #{@dependency}}"
end

#match(policy) ⇒ Object



18
19
20
# File 'lib/mudguard/domain/dependency.rb', line 18

def match(policy)
  @dependency.match(policy)
end