Class: ArchSpec::Rules::DependencyRule

Inherits:
Object
  • Object
show all
Defined in:
lib/archspec/rules/dependency_rules.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, targets) ⇒ DependencyRule

Returns a new instance of DependencyRule.



8
9
10
11
# File 'lib/archspec/rules/dependency_rules.rb', line 8

def initialize(source, targets)
  @source = source.to_sym
  @targets = Array(targets).flatten.map(&:to_sym).to_set
end

Instance Attribute Details

#sourceObject (readonly)

Returns the value of attribute source.



6
7
8
# File 'lib/archspec/rules/dependency_rules.rb', line 6

def source
  @source
end

#targetsObject (readonly)

Returns the value of attribute targets.



6
7
8
# File 'lib/archspec/rules/dependency_rules.rb', line 6

def targets
  @targets
end

Instance Method Details

#merge!(other) ⇒ Object



17
18
19
20
# File 'lib/archspec/rules/dependency_rules.rb', line 17

def merge!(other)
  targets.merge(other.targets)
  self
end

#merge_keyObject



13
14
15
# File 'lib/archspec/rules/dependency_rules.rb', line 13

def merge_key
  [self.class, source]
end