Class: Foobara::Generators::DomainGenerator::DomainConfig
- Defined in:
- foobara-domain-generator-0.0.3/src/domain_config.rb
Instance Attribute Summary collapse
-
#module_path ⇒ Object
Returns the value of attribute module_path.
Attributes inherited from Model
Instance Method Summary collapse
-
#initialize(attributes = nil, options = {}) ⇒ DomainConfig
constructor
A new instance of DomainConfig.
Methods inherited from Model
#==, abstract, abstract?, attribute_names, #attributes, #attributes_with_delegates, #cast_attribute, #cast_attribute!, closest_namespace_module, description, domain, domain_name, #eql?, foobara_model_name, foobara_name, full_model_name, #hash, install!, organization_name, possible_errors, #read_attribute, #read_attribute!, reset_all, subclass, #to_h, #to_json, #valid?, valid_attribute_name?, #validate!, validate_attribute_name!, #validation_errors, #write_attribute, #write_attribute!, #write_attributes, #write_attributes!
Methods included from Concern
foobara_class_methods_module_for, foobara_concern?, included
Constructor Details
#initialize(attributes = nil, options = {}) ⇒ DomainConfig
Returns a new instance of DomainConfig.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'foobara-domain-generator-0.0.3/src/domain_config.rb', line 16 def initialize(attributes = nil, = {}) full_module_name = attributes[:full_module_name] module_path = full_module_name&.split("::") name = attributes[:name] description = attributes[:description] organization_name = attributes[:organization_name] if organization_name.nil? && full_module_name.nil? full_module_name = name module_path = full_module_name.split("::") *organization_parts, name = module_path unless organization_parts.empty? organization_name = organization_parts.join("::") end end full_module_name ||= [*organization_name, *name].compact.join("::") super( { name:, description:, organization_name:, full_module_name: }, ) self.module_path = module_path end |
Instance Attribute Details
#module_path ⇒ Object
Returns the value of attribute module_path.
14 15 16 |
# File 'foobara-domain-generator-0.0.3/src/domain_config.rb', line 14 def module_path @module_path end |