Skip to content

Instantly share code, notes, and snippets.

@ore-public
Last active August 29, 2015 14:22

Revisions

  1. Masaya Konishi revised this gist May 29, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@ class Hoge

    def mmtest
    hoge #method_missing が呼ばれる => :hoge
    hoge = 10 #mmtestのローカル変数が定義される
    hoge = 10 #mmtestメソッド内のローカル変数が定義される
    self.hoge=10 #method_missing が呼ばれる => :hoge=
    end

  2. Masaya Konishi created this gist May 29, 2015.
    15 changes: 15 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    class Hoge

    def mmtest
    hoge #method_missing が呼ばれる => :hoge
    hoge = 10 #mmtestのローカル変数が定義される
    self.hoge=10 #method_missing が呼ばれる => :hoge=
    end

    def method_missing(method_name, *args)
    p method_name
    end
    end

    h = Hoge.new
    h.mmtest