Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ruby is God

Ruby is God

Ruby's class is mutable.

さっちゃん

January 26, 2018
Tweet

More Decks by さっちゃん

Other Decks in Programming

Transcript

  1. class BasicObject def method_missing(method_name, *args) p "Momonga say #{method_name}" end

    end class Sample end Sample.new.sample "Momonga say sample"
  2. class BasicObject def method_missing(method_name, *args) p "Momonga say #{method_name}" end

    end class Sample def sample p 42 end end Sample.new.sample ?
  3. class BasicObject def method_missing(method_name, *args) p "Momonga say #{method_name}" end

    end class Sample def sample p 42 end end Sample.new.sample 42
  4. class BasicObject def method_missing(method_name, *args) p "Momonga say #{method_name}" end

    end class Sample def sample p 42 end end Sample.new.sample ?
  5. class BasicObject def method_missing(method_name, *args) p "Momonga say #{method_name}" end

    end class Sample def sample p 42 end end Sample.new.sample "Momonga say sample"
  6. class BasicObject def self.method_added(method_name) if method_name != :method_missing remove_method method_name

    end end end class BasicObject def method_missing(method_name, *args) p "Momonga say #{method_name}" end end class Sample def sample p 42 end end Sample.new.sample "Momonga say sample"
  7. class BasicObject def self.method_added(method_name) if method_name != :method_missing remove_method method_name

    end end end class BasicObject def method_missing(method_name, *args) p "Momonga say #{method_name}" end end class Sample def sample p 42 end end Sample.new.sample "Momonga say sample" ʊਓਓਓਓਓʊ ʼɹ͓ΘΓɹʻ ʉY^Y^Y^Yʉ