module Unparser::AbstractType::AbstractMethodDeclarations
Public Instance Methods
abstract_method(*names)
click to toggle source
Create abstract instance methods
@example
class Foo include AbstractType # Create an abstract instance method abstract_method :some_method end
@param [Array<#to_s>] names
@return [self]
@api public
# File lib/unparser/abstract_type.rb, line 64 def abstract_method(*names) names.each(&method(:create_abstract_instance_method)) self end
abstract_singleton_method(*names)
click to toggle source
Create abstract singleton methods
@example
class Foo include AbstractType # Create an abstract instance method abstract_singleton_method :some_method end
@param [Array<#to_s>] names
@return [self]
@api private
# File lib/unparser/abstract_type.rb, line 84 def abstract_singleton_method(*names) names.each(&method(:create_abstract_singleton_method)) self end
Private Instance Methods
create_abstract_instance_method(name)
click to toggle source
Create abstract instance method
@param [#to_s] name
the name of the method to create
@return [undefined]
@api private
# File lib/unparser/abstract_type.rb, line 113 def create_abstract_instance_method(name) define_method(name) do |*| fail NotImplementedError, "#{self.class}##{name} is not implemented" end end
create_abstract_singleton_method(name)
click to toggle source
Create abstract singleton method
@param [#to_s] name
the name of the method to create
@return [undefined]
@api private
# File lib/unparser/abstract_type.rb, line 99 def create_abstract_singleton_method(name) define_singleton_method(name) do |*| fail NotImplementedError, "#{self}.#{name} is not implemented" end end