A method to determine if an object responds to a message (e.g., a method
call). In Active Resource, a Person object with
a name attribute can answer true to
my_person.respond_to?("name"),my_person.respond_to?("name="), and
my_person.respond_to?("name?").
# File activeresource/lib/active_resource/base.rb, line 908
def respond_to?(method, include_priv = false)
method_name = method.to_s
if attributes.nil?
return super
elsif attributes.has_key?(method_name)
return true
elsif ['?','='].include?(method_name.last) && attributes.has_key?(method_name.first(-1))
return true
end
# super must be called at the end of the method, because the inherited respond_to?
# would return true for generated readers, even if the attribute wasn't present
super
end