Commit 9a9e12a1 authored by dearblue's avatar dearblue

Add proc composition feature (CRuby-2.6 compatible)

  - Proc#<< and Proc#>>
  - Method#<< and Method#>>
parent 3e59f25e
......@@ -17,4 +17,12 @@ class Method
def name
@name
end
def <<(other)
->(*args, &block) { call(other.call(*args, &block)) }
end
def >>(other)
->(*args, &block) { other.call(call(*args, &block)) }
end
end
......@@ -39,4 +39,12 @@ class Proc
make_curry.call
end
def <<(other)
->(*args, &block) { call(other.call(*args, &block)) }
end
def >>(other)
->(*args, &block) { other.call(call(*args, &block)) }
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment