Sha256: 0b0c57403f1efb693bd038188443afc124a6901ca785cfd104b6e3e1cbc84317
Contents?: true
Size: 463 Bytes
Versions: 1
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(:x, :y)} do calcx(x) + calcx(y) end seems as {mul(:x, :y)} do calcx(x) * calcx(y) end end func(:calcx).seems as {:value} do value end end p CalcX.new.calcx(code)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
patternmatching-0.1.0 | examples/partial_style_method2.rb |