File: proc_compose.rb

package info (click to toggle)
ruby-tins 1.32.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,248 kB
  • sloc: ruby: 6,659; makefile: 3
file content (15 lines) | stat: -rw-r--r-- 276 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module Tins
  module ProcCompose
    def compose(other)
      self.class.new do |*args|
        if other.respond_to?(:call)
          call(*other.call(*args))
        else
          call(*other.to_proc.call(*args))
        end
      end
    end

    alias * compose
  end
end