Module: Lab42::CheckedClass

Defined in:
lib/lab42/checked_class.rb,
lib/lab42/checked_class/mixin.rb,
lib/lab42/checked_class/proxy.rb,
lib/lab42/checked_class/version.rb,
lib/lab42/checked_class/injector.rb,
lib/lab42/checked_class/constraint.rb,
lib/lab42/checked_class/argument_checker.rb,
lib/lab42/checked_class/constraint_error.rb,
lib/lab42/checked_class/constraint_checker.rb,
lib/lab42/checked_class/mixin/class_methods.rb,
lib/lab42/checked_class/constraint/predefined.rb

Defined Under Namespace

Modules: Mixin Classes: ArgumentChecker, Constraint, ConstraintChecker, Injector, Proxy

Constant Summary collapse

VERSION =
'0.2.1'
ConstraintError =
Class.new(RuntimeError)

Class Method Summary collapse

Class Method Details

.extended(extendee) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/lab42/checked_class.rb', line 7

def self.extended(extendee)
  # base_proxy =
  #   extendee
  #   .ancestors
  #   .grep(self)
  #   .drop(1)
  #   .first
  #     &.__checked_class_proxy__

  # proxy = base_proxy ? Proxy.from_parent(base_proxy, extendee) : Proxy.new(extendee)
  proxy = Proxy.new(extendee) 

  extendee.module_eval do
    define_singleton_method(:__checked_class_proxy__){ proxy }
  end
end