Class: Deface::Environment::Overrides

Inherits:
Object
  • Object
show all
Defined in:
lib/deface/environment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOverrides

Returns a new instance of Overrides.



15
16
17
# File 'lib/deface/environment.rb', line 15

def initialize
  @all = {}
end

Instance Attribute Details

#allObject

Returns the value of attribute all.



13
14
15
# File 'lib/deface/environment.rb', line 13

def all
  @all
end

Instance Method Details

#early_checkObject



40
41
42
43
44
45
46
# File 'lib/deface/environment.rb', line 40

def early_check
  Deface::Override._early.each do |args|
    Deface::Override.new(args)
  end

  Deface::Override._early.clear
end

#find(*args) ⇒ Object



19
20
21
# File 'lib/deface/environment.rb', line 19

def find(*args)
  Deface::Override.find(*args)
end

#load_all(app) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/deface/environment.rb', line 23

def load_all(app)
  #clear overrides before reloading them
  app.config.deface.overrides.all.clear

  # check application for specified overrides paths
  override_paths = app.paths["app/overrides"]
  enumerate_and_load(override_paths, app.root)

  # check all railties / engines / extensions for overrides
  app.railties.all.each do |railtie|
    next unless railtie.respond_to? :root

    override_paths = railtie.respond_to?(:paths) ? railtie.paths["app/overrides"] : nil
    enumerate_and_load(override_paths, railtie.root)
  end
end