rubyでは存在しないメソッドを呼び出すとmethod_missingが呼び出される
https://docs.ruby-lang.org/ja/latest/method/BasicObject/i/method_missing.html
これを利用し、rubyでProxyクラスを実装する場合、method_missingを利用すると、簡単に実装することができる
https://morizyun.github.io/ruby/design-pattern-proxy.html
class Sample
def method_missing(method_name, *args)
puts method_name
p args
end
end
Sample.new.unknown_method(1,2,3)
# > unknown_method
# > [1, 2, 3]