Class: Ruleby::Core::CompositePattern
- Defined in:
- lib/core/patterns.rb
Overview
A composite pattern represents a logical conjunction of two patterns. The inference engine interprets this differently from an ObjectPattern because it simply aggregates patterns.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#left_pattern ⇒ Object
readonly
Returns the value of attribute left_pattern.
-
#right_pattern ⇒ Object
readonly
Returns the value of attribute right_pattern.
Instance Method Summary collapse
- #atoms ⇒ Object
-
#initialize(left_pattern, right_pattern) ⇒ CompositePattern
constructor
A new instance of CompositePattern.
Constructor Details
#initialize(left_pattern, right_pattern) ⇒ CompositePattern
Returns a new instance of CompositePattern.
75 76 77 78 |
# File 'lib/core/patterns.rb', line 75 def initialize(left_pattern, right_pattern) @left_pattern = left_pattern @right_pattern = right_pattern end |
Instance Attribute Details
#left_pattern ⇒ Object (readonly)
Returns the value of attribute left_pattern.
72 73 74 |
# File 'lib/core/patterns.rb', line 72 def left_pattern @left_pattern end |
#right_pattern ⇒ Object (readonly)
Returns the value of attribute right_pattern.
73 74 75 |
# File 'lib/core/patterns.rb', line 73 def right_pattern @right_pattern end |
Instance Method Details
#atoms ⇒ Object
80 81 82 83 84 85 |
# File 'lib/core/patterns.rb', line 80 def atoms atoms = [] atoms.push @left_pattern.atoms atoms.push @right_pattern.atoms return atoms end |