Module: EacRubyUtils::ActsAsAbstract

Included in:
Speaker::Receiver
Defined in:
lib/eac_ruby_utils/acts_as_abstract.rb

Overview

Support to abstract methods.

Usage:

require 'eac_ruby_utils/acts_as_abstract'

class BaseClass
  include EacRubyUtils::ActsAsAbstract

  abstract_methods :mymethod
end

BaseClass.new.mymethod # raise "Abstract method: mymethod"

class SubClass
  def mymethod
    "Implemented"
  end
end

SubClass.new.mymethod # return "Implemented"

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.abstract?(a_class) ⇒ Boolean

Returns:



34
35
36
# File 'lib/eac_ruby_utils/acts_as_abstract.rb', line 34

def abstract?(a_class)
  a_class.self_included_modules.include?(::EacRubyUtils::ActsAsAbstract)
end