module Unparser::AbstractType
def self.create_new_method(abstract_class)
- Api: - private
Returns:
-
(undefined)
-
Parameters:
-
abstract_class
(Class
) --
def self.create_new_method(abstract_class) abstract_class.define_singleton_method(:new) do |*args, &block| if equal?(abstract_class) fail NotImplementedError, "#{self} is an abstract type" else super(*args, &block) end end end
def self.included(descendant)
- Api: - private
Returns:
-
(undefined)
-
Parameters:
-
descendant
(Module
) --
def self.included(descendant) super create_new_method(descendant) descendant.extend(AbstractMethodDeclarations) end