Calling a Protected Superclass Class Method in Ruby -
i want call protected superclass class method instance method in base class.
class class << self protected def foo puts "in foo" end end end class b < def bar puts "in bar" # call a::foo end end
what's best way this?
override method in b, calling super:
class class << self protected def foo puts "in foo" end end end class b < def self.foo super end def bar puts "in bar" # call a::foo self.class.foo end end >> b.foo => in foo >> b.new.bar => in bar => in foo
Comments
Post a Comment