Module: SmartCore::Validator::ClassState::InitializeMixin
- Included in:
- SmartCore::Validator::Contract
- Defined in:
- lib/smart_core/validator/class_state/initialize_mixin.rb
Class Method Summary collapse
Class Method Details
.add_delegators_to(mod) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/smart_core/validator/class_state/initialize_mixin.rb', line 14 def self.add_delegators_to(mod) mod.instance_eval do extend Forwardable extend SingleForwardable def_single_delegators :__state_container__, :schema_class, :configuration, :rules def_single_delegators :configuration, :configure, :settings def_instance_delegators 'self.class', :settings, :rules, :schema_class end end |
.included(mod) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/smart_core/validator/class_state/initialize_mixin.rb', line 5 def self.included(mod) super mod.singleton_class.attr_accessor :__state_container__ mod.singleton_class.send(:protected, :__state_container__=) mod.instance_variable_set(:@__state_container__, Container.create_base_container) add_delegators_to(mod) end |