When writing my plugin Spreadsheet Architect I needed to check if methods were defined on both the class and instances. Heres two fast ways to do this:
Post.respond_to?(:item_name) #=> false
@post.respond_to?(:item_name) #=> true
# Check if the instance method is defined
Post.method_defined?(:some_instance_method) #=> false
@post.method_defined?(:some_instance_method) #=> true
Related External Links: