Module: Effective::Resources::Generator

Included in:
Effective::Resource
Defined in:
app/models/effective/resources/generator.rb

Instance Method Summary collapse

Instance Method Details

#module_nameObject



7
8
9
10
11
# File 'app/models/effective/resources/generator.rb', line 7

def module_name
  return nil unless class_name.split('::').length > 1

  class_name.split('::').first
end

#module_namespaceObject

Acpa



14
15
16
17
18
# File 'app/models/effective/resources/generator.rb', line 14

def module_namespace
  return nil unless namespaces.present?

  Array(namespaces + [nil]).map { |name| name.to_s.classify } * '::'
end

#module_namespacedObject

Admin::Courses



21
22
23
# File 'app/models/effective/resources/generator.rb', line 21

def module_namespaced
  (Array(namespaces).map { |name| name.to_s.classify } + [plural_name.classify.pluralize]) * '::'
end

#namespaced_class_nameObject

‘Admin::Effective::Post’



25
26
27
# File 'app/models/effective/resources/generator.rb', line 25

def namespaced_class_name # 'Admin::Effective::Post'
  (Array(namespaces).map { |name| name.to_s.classify } + [class_name]) * '::'
end

#namespaced_module_nameObject

‘Admin::EffectivePosts’



29
30
31
# File 'app/models/effective/resources/generator.rb', line 29

def namespaced_module_name # 'Admin::EffectivePosts'
  Array(namespaces).map { |name| name.to_s.classify }.join('::') + '::' + class_name.gsub('::', '')
end

#tenant_class_nameObject



46
47
48
# File 'app/models/effective/resources/generator.rb', line 46

def tenant_class_name
  (Tenant.module_name + '::' + class_name) if tenant?
end

#tenant_controller_pathObject

Tenants



34
35
36
# File 'app/models/effective/resources/generator.rb', line 34

def tenant_controller_path
  (Tenant.module_name.downcase + '/' + controller_path) if tenant?
end

#tenant_namespaced_class_nameObject



38
39
40
# File 'app/models/effective/resources/generator.rb', line 38

def tenant_namespaced_class_name
  (Tenant.module_name + '::' + namespaced_class_name) if tenant?
end

#tenant_namespaced_module_nameObject



42
43
44
# File 'app/models/effective/resources/generator.rb', line 42

def tenant_namespaced_module_name
  (Tenant.module_name + '::' + namespaced_module_name) if tenant?
end