Skip to content

Instantly share code, notes, and snippets.

@apotonick
Last active June 15, 2017 09:10
Show Gist options
  • Save apotonick/f3f6e01bd5d4d3b9ad95410530019993 to your computer and use it in GitHub Desktop.
Save apotonick/f3f6e01bd5d4d3b9ad95410530019993 to your computer and use it in GitHub Desktop.
Circuit Ruby pre compiler
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