Last active
June 15, 2017 09:10
-
-
Save apotonick/f3f6e01bd5d4d3b9ad95410530019993 to your computer and use it in GitHub Desktop.
Circuit Ruby pre compiler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class KW | |
def self.call | |
# | |
# proc! | |
# or | |
# meth! | |
end | |
def self.meth! | |
end | |
end | |
# |-- meth? | |
# |-- {true} meth! | |
# |-- {false} proc! | |
# class KW < Circuit | |
circuit KW | |
meth? | |
true meth! | |
false proc! | |
def meth?(options) | |
end | |
end | |
# replacing task | |
circuit DeprecatedKW < KW | |
# replace proc! we don't even have to "say" that, it is done by circuit as it sees proc! | |
def proc! | |
end | |
end | |
# pipeline | |
circuit KW | |
a | |
b # means `true/Right b` | |
Left c | |
end | |
# how do we do something like | |
def call! | |
if .. | |
else | |
super | |
end? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment