Class: PatternMatch::OrPattern
- Inherits:
-
PatternElement
- Object
- Pattern
- PatternElement
- PatternMatch::OrPattern
- Defined in:
- lib/egison/core.rb
Instance Attribute Summary collapse
-
#pats ⇒ Object
readonly
Returns the value of attribute pats.
Attributes inherited from Pattern
Instance Method Summary collapse
-
#initialize(*subpatterns) ⇒ OrPattern
constructor
A new instance of OrPattern.
- #match(tgt, bindings) ⇒ Object
Methods inherited from Pattern
Constructor Details
#initialize(*subpatterns) ⇒ OrPattern
Returns a new instance of OrPattern.
224 225 226 227 |
# File 'lib/egison/core.rb', line 224 def initialize(*subpatterns) super() @pats = subpatterns end |
Instance Attribute Details
#pats ⇒ Object (readonly)
Returns the value of attribute pats.
222 223 224 |
# File 'lib/egison/core.rb', line 222 def pats @pats end |
Instance Method Details
#match(tgt, bindings) ⇒ Object
229 230 231 |
# File 'lib/egison/core.rb', line 229 def match(tgt, bindings) @pats.map { |pat| [[[pat, tgt]], []] } end |