Sha256: bbb2c778be98f0115e666ced9a536b09883e28224dcbee18b4cc3f9d9bd5bb3d
Contents?: true
Size: 463 Bytes
Versions: 8
Compression:
Stored size: 463 Bytes
Contents
require "patternmatching" # You can use local variables or methods inside builder val = 200 code = PatternMatching.build {plus(mul(100, 100), val)} # Another partial style method example class CalcX extend PatternMatching func(:calcx) do seems as {plus(:a, :b)} do calcx(a) + calcx(b) end seems as {mul(:x, :y)} do calcx(a) * calcx(b) end end func(:calcx).seems as {:value} do value end end p CalcX.new.calcx(code)
Version data entries
8 entries across 8 versions & 1 rubygems