Project

General

Profile

Bug #9542 » the_bug.rb

vrinek (Konstantinos Karachalios), 02/20/2014 04:25 PM

 
require "delegate"

class Cow
def unprotected_moo
"mooooo!"
end

protected

def protected_moo
"guarded mooooo!"
end
end

my_cow = Cow.new

puts SimpleDelegator.new(my_cow).unprotected_moo
# => "mooooo!"

puts SimpleDelegator.new(my_cow).protected_moo
# => "guarded mooooo!"
(1-1/2)