Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Class
- def const_missing(id)
- puts "Class#const_missing"
- end
- end
- module Mdl
- def const_missing(id)
- puts "Mdl#const_missing"
- end
- end
- class Cls1
- include Mdl
- def const_missing(id)
- puts "Cls1#const_missing"
- end
- end
- class Cls2 < Cls1
- def hoge
- puts "CONST_VAR: #{CONST_VAR}"
- end
- def const_missing(id)
- puts "Cls2#const_missing"
- end
- end
- # Class で定義した cons_missing が実行される
- Cls2.new.hoge # :=> Class#const_missing
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement