In ruby 1.8.5, self, in an instance_eval block, is subject to the same access modifiers as any old instance variable. Protected, and private methods raise "NoMethodError: protected/private method `x' called for ...". Luckily, though, the send(:method_name) hack still works to get around any access modifier. So, if you need to get your code running on 1.8.5, that's the workaround.
class Person
protected
def something_secret
"don't tell anybody"
end
private
def something_really_secret
"REALLY don't tell anybody"
end
end
## Ruby 1.8.5
person.instance_eval { self.something_secret } # NoMethodError: protected method `something_secret' called for ...
person.instance_eval { self.something_really_secret } # NoMethodError: protected method `something_really_secret' called for ...
person.send :something_secret # "don't tell anybody"
person.send :something_really_secret # "REALLY don't tell anybody"
## Ruby 1.8.6
person.instance_eval { self.something_secret } # "don't tell anybody"
person.instance_eval { self.something_really_secret } # "REALLY don't tell anybody"
person.send :something_secret # "don't tell anybody"
person.send :something_really_secret # "REALLY don't tell anybody"

