Class: Yogo::Operation
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Proc
Class Method Details
.on(type, &block) ⇒ Object
9 10 11 12 13 |
# File 'lib/yogo/operation.rb', line 9 def self.on(type, &block) op = self.new(&block) op.instance_eval{ self.type = type } op end |
Instance Method Details
#call(*args) ⇒ Object
15 16 17 18 19 |
# File 'lib/yogo/operation.rb', line 15 def call(*args) x = args.first raise "Can only invoke on #{type}" if type && !x.is_a?(type) super(*args) end |