Class: CascadingConfiguration::Core::Module
- Inherits:
-
Module
- Object
- Module
- CascadingConfiguration::Core::Module
- Includes:
- EnableModuleSupport
- Defined in:
- lib/cascading_configuration/core/module.rb
Direct Known Subclasses
BlockConfigurations, ExtendedConfigurations, InheritingValues
Defined Under Namespace
Classes: BlockConfigurations, ExtendedConfigurations, InheritingValues
Constant Summary collapse
- DefaultEncapsulationName =
:default
- DefaultEncapsulation =
::CascadingConfiguration::Core::Encapsulation.new( DefaultEncapsulationName )
Instance Attribute Summary collapse
-
#ccm_aliases ⇒ Object
readonly
ccm_aliases #.
-
#ccm_name ⇒ Object
readonly
ccm_name #.
-
#default_encapsulation ⇒ Object
readonly
default_encapsulation #.
Instance Method Summary collapse
-
#create_configuration(encapsulation, instance, name) ⇒ Object
create_configuration #.
-
#define_cascading_definition_method(ccm_name, *ccm_aliases) ⇒ Object
define_cascading_definition_method #.
-
#define_configurations(instance_controller, encapsulation, method_types, *names, &definer_block) ⇒ Object
define_configurations #.
-
#define_definition_methods(ccm_name, *ccm_aliases) ⇒ Object
define_definition_methods #.
-
#define_instance_definition_method(ccm_name, *ccm_aliases) ⇒ Object
define_instance_definition_method #.
-
#define_local_instance_definition_method(ccm_name, *ccm_aliases) ⇒ Object
define_local_instance_definition_method #.
-
#define_module_definition_method(ccm_name, *ccm_aliases) ⇒ Object
define_module_definition_method #.
-
#define_object_definition_method(ccm_name, *ccm_aliases) ⇒ Object
define_object_definition_method #.
-
#initialize(ccm_name, default_encapsulation_or_name = ::CascadingConfiguration::Core::Module::DefaultEncapsulation, *ccm_aliases) ⇒ Module
constructor
initialize #.
-
#initialize_configuration(encapsulation, instance, name) ⇒ Object
initialize_configuration #.
Methods included from EnableModuleSupport
Constructor Details
#initialize(ccm_name, default_encapsulation_or_name = ::CascadingConfiguration::Core::Module::DefaultEncapsulation, *ccm_aliases) ⇒ Module
initialize #
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cascading_configuration/core/module.rb', line 13 def initialize( ccm_name, default_encapsulation_or_name = ::CascadingConfiguration::Core::Module::DefaultEncapsulation, *ccm_aliases ) super() encapsulation = ::CascadingConfiguration::Core::Encapsulation.encapsulation( default_encapsulation_or_name ) @default_encapsulation = encapsulation @ccm_name = ccm_name @ccm_aliases = ccm_aliases define_definition_methods( @ccm_name, *@ccm_aliases ) end |
Instance Attribute Details
#ccm_aliases ⇒ Object (readonly)
ccm_aliases #
46 47 48 |
# File 'lib/cascading_configuration/core/module.rb', line 46 def ccm_aliases @ccm_aliases end |
#ccm_name ⇒ Object (readonly)
ccm_name #
40 41 42 |
# File 'lib/cascading_configuration/core/module.rb', line 40 def ccm_name @ccm_name end |
#default_encapsulation ⇒ Object (readonly)
default_encapsulation #
34 35 36 |
# File 'lib/cascading_configuration/core/module.rb', line 34 def default_encapsulation @default_encapsulation end |
Instance Method Details
#create_configuration(encapsulation, instance, name) ⇒ Object
create_configuration #
133 134 135 136 137 138 139 |
# File 'lib/cascading_configuration/core/module.rb', line 133 def create_configuration( encapsulation, instance, name ) encapsulation.register_configuration( instance, name, self ) return self end |
#define_cascading_definition_method(ccm_name, *ccm_aliases) ⇒ Object
define_cascading_definition_method #
66 67 68 69 70 71 72 73 |
# File 'lib/cascading_configuration/core/module.rb', line 66 def define_cascading_definition_method( ccm_name, *ccm_aliases ) ccm_method_name = cascading_method_name( ccm_name ) ccm_alias_names = ccm_aliases.collect { |this_alias| cascading_method_name( this_alias ) } return define_method_with_extension_modules( ccm_method_name, ccm_alias_names, :all ) end |
#define_configurations(instance_controller, encapsulation, method_types, *names, &definer_block) ⇒ Object
define_configurations #
155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/cascading_configuration/core/module.rb', line 155 def define_configurations( instance_controller, encapsulation, method_types, *names, & definer_block ) accessors = instance_controller.define_configuration_methods( self, encapsulation, method_types, names, & definer_block ) instance = instance_controller.instance accessors.each do |this_accessor, this_write_accessor| create_configuration( encapsulation, instance, this_accessor ) end end |
#define_definition_methods(ccm_name, *ccm_aliases) ⇒ Object
define_definition_methods #
52 53 54 55 56 57 58 59 60 |
# File 'lib/cascading_configuration/core/module.rb', line 52 def define_definition_methods( ccm_name, *ccm_aliases ) define_cascading_definition_method( ccm_name, *ccm_aliases ) define_module_definition_method( ccm_name, *ccm_aliases ) define_instance_definition_method( ccm_name, *ccm_aliases ) define_object_definition_method( ccm_name, *ccm_aliases ) define_local_instance_definition_method( ccm_name, *ccm_aliases ) end |
#define_instance_definition_method(ccm_name, *ccm_aliases) ⇒ Object
define_instance_definition_method #
94 95 96 97 98 99 100 101 |
# File 'lib/cascading_configuration/core/module.rb', line 94 def define_instance_definition_method( ccm_name, *ccm_aliases ) ccm_method_name = instance_method_name( ccm_name ) ccm_alias_names = ccm_aliases.collect { |this_alias| instance_method_name( this_alias ) } return define_method_with_extension_modules( ccm_method_name, ccm_alias_names, :instance ) end |
#define_local_instance_definition_method(ccm_name, *ccm_aliases) ⇒ Object
define_local_instance_definition_method #
107 108 109 110 111 112 113 114 |
# File 'lib/cascading_configuration/core/module.rb', line 107 def define_local_instance_definition_method( ccm_name, *ccm_aliases ) ccm_method_name = local_instance_method_name( ccm_name ) ccm_alias_names = ccm_aliases.collect { |this_alias| local_instance_method_name( this_alias ) } return define_method_with_extension_modules( ccm_method_name, ccm_alias_names, :local_instance ) end |
#define_module_definition_method(ccm_name, *ccm_aliases) ⇒ Object
define_module_definition_method #
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/cascading_configuration/core/module.rb', line 79 def define_module_definition_method( ccm_name, *ccm_aliases ) ccm_method_name = module_method_name( ccm_name ) ccm_alias_names = [ class_method_name( ccm_name ) ] ccm_alias_names.concat( ccm_aliases.collect { |this_alias| module_method_name( this_alias ) } ) ccm_alias_names.concat( ccm_aliases.collect { |this_alias| class_method_name( this_alias ) } ) return define_method_with_extension_modules( ccm_method_name, ccm_alias_names, :module ) end |
#define_object_definition_method(ccm_name, *ccm_aliases) ⇒ Object
define_object_definition_method #
120 121 122 123 124 125 126 127 |
# File 'lib/cascading_configuration/core/module.rb', line 120 def define_object_definition_method( ccm_name, *ccm_aliases ) ccm_method_name = object_method_name( ccm_name ) ccm_alias_names = ccm_aliases.collect { |this_alias| object_method_name( this_alias ) } return define_method_with_extension_modules( ccm_method_name, ccm_alias_names, :object ) end |
#initialize_configuration(encapsulation, instance, name) ⇒ Object
initialize_configuration #
145 146 147 148 149 |
# File 'lib/cascading_configuration/core/module.rb', line 145 def initialize_configuration( encapsulation, instance, name ) # Nothing here - for subclasses to define. end |