Check new added instance methods against Object : attr « Class « Ruby






Check new added instance methods against Object


#!/usr/bin/env ruby

class Dog
  attr :bark, true
end

p Dog.instance_methods.sort - Object.instance_methods # => [ "bark", "bark=" ]

 








Related examples in the same category

1.Use attr to add two attributes