2017-08-30 17:21:13 +03:00
|
|
|
module Mom
|
|
|
|
|
2017-09-06 12:08:44 +03:00
|
|
|
# A base class for conditions in MOM
|
|
|
|
# Just a marker, no real functionality for now
|
|
|
|
|
|
|
|
class Check < Instruction
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2017-08-30 17:21:13 +03:00
|
|
|
# The funny thing about the ruby truth is that is is anything but false or nil
|
|
|
|
#
|
|
|
|
# To implement the normal ruby logic, we check for false or nil and jump
|
|
|
|
# to the false branch. true_block follows implicitly
|
|
|
|
#
|
2017-09-04 21:00:08 +03:00
|
|
|
class TruthCheck < Check
|
|
|
|
attr_reader :condition
|
2017-08-30 17:21:13 +03:00
|
|
|
|
2017-09-04 21:00:08 +03:00
|
|
|
def initialize(condition)
|
2017-09-06 12:08:44 +03:00
|
|
|
@condition = condition
|
2017-08-30 17:21:13 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|