From c99afec9cc5077c70e51571c8dd996d2ed30a1bf Mon Sep 17 00:00:00 2001 From: Hyun Ahn Date: Sun, 22 Jan 2023 15:17:50 +0900 Subject: [PATCH] =?UTF-8?q?fix=20=EC=98=A4=ED=83=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _posts/2019-01-17-ruby-mixin-concern.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/2019-01-17-ruby-mixin-concern.md b/_posts/2019-01-17-ruby-mixin-concern.md index 8b2b529..b6e230d 100644 --- a/_posts/2019-01-17-ruby-mixin-concern.md +++ b/_posts/2019-01-17-ruby-mixin-concern.md @@ -43,7 +43,7 @@ irb > MyModule.new.instance_method 클래스의 인스턴스 메서드를 호출하면 ancestors 배열의 앞에서부터 메서드 정의를 찾습니다. 상속 개념과 유사하게, 메서드 정의를 찾지 못하면 다음 조상에게서 찾는 식입니다. 즉 둘 이상의 선조들이 같은 이름의 메서드를 정의하고 있다면 더 가까운 선조에 정의된 메서드를 실행합니다. 참고로 `BasicObject`까지 거슬러 올라갔는데도 메서드를 찾지 못하면 [BasicObject#method_missing](https://ruby-doc.org/core-2.5.0/BasicObject.html#method-i-method_missing)이 실행되는데, 몇몇 루비 gem들은 이를 이용해 이해하기 쉽지 않은 흑마술을 부리기도 하더군요. ```ruby -irb > String.acenstors +irb > String.ancestors # => [String, Comparable, Object, Kernel, BasicObject] irb > String.included_modules # => [Comparable, Kernel]