mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
9a9e12a129
- Proc#<< and Proc#>> - Method#<< and Method#>>
29 lines
357 B
Ruby
29 lines
357 B
Ruby
class Method
|
|
def to_proc
|
|
m = self
|
|
lambda { |*args, &b|
|
|
m.call(*args, &b)
|
|
}
|
|
end
|
|
|
|
def owner
|
|
@owner
|
|
end
|
|
|
|
def receiver
|
|
@recv
|
|
end
|
|
|
|
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
|