summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-method/mrblib/method.rb
blob: 09b611eb7af82cc3098e2ca7bc1b36c5fab340cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class Method
  def to_proc
    m = self
    lambda { |*args, **opts, &b|
      m.call(*args, **opts, &b)
    }
  end

  def <<(other)
    ->(*args, **opts, &block) { call(other.call(*args, **opts, &block)) }
  end

  def >>(other)
    ->(*args, **opts, &block) { other.call(call(*args, **opts, &block)) }
  end
end