Skip to content

Enabling Features

mosop edited this page Nov 23, 2016 · 8 revisions

Callback.enable and callback!

Callback.enable defines a callback! macro method into a specified class. The callback! method enables the class to use the callback features.

require "callback"

Callback.enable Reference

class MyClass
  callback!
end

You can also limit the scope.

require "callback"

class MyClass
  Callback.enable
  callback!
end

class AnotherClass
  callback! # raises a compile error
end
Clone this wiki locally