2018-07-07 14:50:43 +02:00
|
|
|
module Parfait
|
|
|
|
|
|
|
|
# A Block is a callable object, much like a CallableMethod.
|
|
|
|
# Surprisingly similar in fact, as the block is really only missing the name.
|
|
|
|
#
|
2019-08-06 17:33:27 +02:00
|
|
|
# The difference lies mostly in the way they are compiled (scope and return)
|
2018-07-07 14:50:43 +02:00
|
|
|
#
|
|
|
|
# Also both have a list of blocks defined in their scope. But this is
|
2019-08-06 17:33:27 +02:00
|
|
|
# not implemented for blocks yet
|
2018-07-07 14:50:43 +02:00
|
|
|
#
|
|
|
|
class Block < Callable
|
|
|
|
|
|
|
|
def ==(other)
|
|
|
|
return false unless other.is_a?(Block)
|
|
|
|
super
|
|
|
|
end
|
|
|
|
|
|
|
|
def inspect
|
2018-08-11 18:15:34 +02:00
|
|
|
"#{self_type.object_class.name}(#{arguments_type.inspect})"
|
2018-07-07 14:50:43 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|