From b7f53ba45fc88a83961bfb6f6f8ca8e821a7e70f Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Mon, 28 Dec 2020 14:06:40 +0900 Subject: [PATCH] Add an example for Module#define_method --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index f3b56aa..a2c3401 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,15 @@ ruby2_keywords def oldstyle_keywords(options = {}) end ``` +You can do the same for a method defined by `Module#define_method`: + +```ruby +define_method :delegating_method do |*args, &block| + other_method(*args, &block) +end +ruby2_keywords :delegating_method +``` + ## Contributing Bug reports and pull requests are welcome on GitHub at https://bugs.ruby-lang.org.