Class: RailsBestPractices::Core::Mod
- Inherits:
-
Object
- Object
- RailsBestPractices::Core::Mod
- Defined in:
- lib/rails_best_practices/core/modules.rb
Overview
Module info include module name and module spaces.
Instance Attribute Summary collapse
-
#decendants ⇒ Object
readonly
Returns the value of attribute decendants.
Instance Method Summary collapse
- #add_decendant(decendant) ⇒ Object
-
#initialize(module_name, modules) ⇒ Mod
constructor
A new instance of Mod.
- #to_s ⇒ Object
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
#decendants ⇒ Object (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_s ⇒ Object
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 |