Class: Patm::Pattern::LogicalOp
- Inherits:
-
Patm::Pattern
- Object
- Patm::Pattern
- Patm::Pattern::LogicalOp
- Defined in:
- lib/patm.rb
Instance Method Summary collapse
- #compile_internal(free_index, target_name = "_obj") ⇒ Object
-
#initialize(pats, op_str) ⇒ LogicalOp
constructor
A new instance of LogicalOp.
Methods inherited from Patm::Pattern
#&, build_from, #compile, #execute, #rest?
Constructor Details
#initialize(pats, op_str) ⇒ LogicalOp
Returns a new instance of LogicalOp.
214 215 216 217 |
# File 'lib/patm.rb', line 214 def initialize(pats, op_str) @pats = pats @op_str = op_str end |
Instance Method Details
#compile_internal(free_index, target_name = "_obj") ⇒ Object
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/patm.rb', line 218 def compile_internal(free_index, target_name = "_obj") srcs = [] i = free_index ctxs = [] @pats.each do|pat| s, c, i = pat.compile_internal(i, target_name) srcs << s ctxs << c end [ srcs.map{|s| "(#{s})" }.join(" #{@op_str}\n"), ctxs.flatten(1), i ] end |