Class: J8::BiConsumer

Inherits:
Object show all
Includes:
Common
Defined in:
lib/j8/bi_consumer.rb

Instance Method Summary collapse

Methods included from Common

callable_from_proc, from_callable, from_callable_class, initialize, lambda?, make_lambda, raise_unless_lambda

Instance Method Details

#accept(o1, o2) ⇒ Object



7
8
9
# File 'lib/j8/bi_consumer.rb', line 7

def accept(o1, o2)
  @callable.call(o1, o2)
end

#then(after = nil, &block) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/j8/bi_consumer.rb', line 11

def then(after = nil, &block)
  callable = from_callable(after, block)

  J8::BiConsumer.new(
    lambda do |o1, o2|
      accept(o1, o2)
      callable.accept(o1, o2)
    end
  )
end