[1] pry(main)> class A
[1] pry(main)* def a;end
[1] pry(main)* end
=> nil
[2] pry(main)> class B < A
[2] pry(main)* end
=> nil
[3] pry(main)> B.new.methods - Object.new.methods
=> [:a]
[4] pry(main)> class C
[4] pry(main)* def c; end
[4] pry(main)* end
=> nil
[5] pry(main)> B = Class.new C
(pry):10: warning: already initialized constant B
=> B
[6] pry(main)> B.new.methods - Object.new.methods
=> [:c]
[1] pry(main)> class A
[1] pry(main)* end
=> nil
[2] pry(main)> class B < A
[2] pry(main)* end
=> nil
[3] pry(main)> B.superclass
=> A
[4] pry(main)> B = Class.new
(pry):6: warning: already initialized constant B
=> B
[5] pry(main)> class B < Object
[5] pry(main)* end
=> nil
[6] pry(main)> B.superclass
=> Object
[1] pry(main)> class A
[1] pry(main)* end
=> nil
[2] pry(main)> class B < A
[2] pry(main)* end
=> nil
[3] pry(main)> B.superclass
=> A
[4] pry(main)> class B < Object
[4] pry(main)* end
=> nil
[5] pry(main)> B.superclass
=> A
[6] pry(main)> class B < BasicObject
[6] pry(main)* end
TypeError: superclass mismatch for class B
from (pry):9:in `<main>'
楼主的系统很靠谱,有痣青年千万不要错过了。
self.class.say_hi
rchardet19
or charlock_holmes
git submodule