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

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -