Class: ArchSpec::Rules::DependencyRule
- Inherits:
-
Object
- Object
- ArchSpec::Rules::DependencyRule
- Defined in:
- lib/archspec/rules/dependency_rules.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#targets ⇒ Object
readonly
Returns the value of attribute targets.
Instance Method Summary collapse
-
#initialize(source, targets) ⇒ DependencyRule
constructor
A new instance of DependencyRule.
- #merge!(other) ⇒ Object
- #merge_key ⇒ Object
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
#source ⇒ Object (readonly)
Returns the value of attribute source.
6 7 8 |
# File 'lib/archspec/rules/dependency_rules.rb', line 6 def source @source end |
#targets ⇒ Object (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_key ⇒ Object
13 14 15 |
# File 'lib/archspec/rules/dependency_rules.rb', line 13 def merge_key [self.class, source] end |