Module: Rails

Defined in:
lib/model_manage/rails.rb

Constant Summary collapse

@@app =
{
  child: {
    models:      [],
    controllers: [],
    helpers:     [],
  },
  inherit: {
    models:      [],
    controllers: [],
    helpers:     [],
  },
}

Class Method Summary collapse

Class Method Details

.add_child(type, base) ⇒ Object



34
35
36
37
38
39
# File 'lib/model_manage/rails.rb', line 34

def self.add_child(type, base)
  (@@app[:child][type] ||= []).tap do |o|
    o.push base
    o.uniq!
  end
end

.add_inherit(type, base) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/model_manage/rails.rb', line 41

def self.add_inherit(type, base)
  (@@app[:inherit][type] ||= []).tap do |o|
    o.push base
    o.uniq!
  end
  @@app[:child][type] -= @@app[:inherit][type]
end

.child_controllersObject



27
28
29
# File 'lib/model_manage/rails.rb', line 27

def self.child_controllers
  @@app[:child][:controllers] 
end

.child_helpersObject



30
31
32
# File 'lib/model_manage/rails.rb', line 30

def self.child_helpers
  @@app[:child][:helpers]     
end

.child_modelsObject



24
25
26
# File 'lib/model_manage/rails.rb', line 24

def self.child_models
  @@app[:child][:models]     
end

.controllersObject



17
18
19
# File 'lib/model_manage/rails.rb', line 17

def self.controllers
  @@app[:child][:controllers] | @@app[:inherit][:controllers]
end

.helpersObject



20
21
22
# File 'lib/model_manage/rails.rb', line 20

def self.helpers
  @@app[:child][:helpers]     | @@app[:inherit][:helpers]
end

.modelsObject



14
15
16
# File 'lib/model_manage/rails.rb', line 14

def self.models
  @@app[:child][:models]      | @@app[:inherit][:models]
end