Class: RailsBestPractices::Core::Mod

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_best_practices/core/modules.rb

Overview

Module info include module name and module spaces.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(module_name, modules) ⇒ Mod

Returns a new instance of Mod.



20
21
22
23
24
# File 'lib/rails_best_practices/core/modules.rb', line 20

def initialize(module_name, modules)
  @module_name = module_name
  @modules = modules
  @decendants = []
end

Instance Attribute Details

#decendantsObject (readonly)

Returns the value of attribute decendants.



18
19
20
# File 'lib/rails_best_practices/core/modules.rb', line 18

def decendants
  @decendants
end

Instance Method Details

#add_decendant(decendant) ⇒ Object



26
27
28
# File 'lib/rails_best_practices/core/modules.rb', line 26

def add_decendant(decendant)
  @decendants << decendant
end

#to_sObject



30
31
32
33
34
35
36
# File 'lib/rails_best_practices/core/modules.rb', line 30

def to_s
  if @modules.empty?
    @module_name
  else
    @modules.map { |modu| "#{modu}::" }.join("") + @module_name
  end
end