I would like to be able to undef the oneton method for this object.
class A end a = A.new def a.foo puts "bar" end # undef a.foo here a.foo # should crash
class A end a = A.new def a.foo puts "bar" end a.instance_eval { undef :foo } a.foo # => undefined method `foo' for #<A:0x8469c60> (NoMethodError)
class << a undef foo end
As an alternative:
a.singleton_class.send :undef_method, :foo
Source: https://habr.com/ru/post/1481949/More articles:Set Selection Element - eloquentAutomatic link to Microsoft.Data.Tools.Schema.Sql.UnitTesting - vb.netHow to show the dropdown below EditText? - androidHow to write 0x00 to a file - cHibernate web application that queries SQL Server 2005 encrypted column - javaAndroid Wallpaper with a choice of service - androidAndroid JsonReader exception when parsing JSON big data - javaUsing the #define macro to standardize class declarations - c ++NullPointerException in setPreviewDisplay (owner) - javaemacs ediff refresh buffers - emacsAll Articles