Module: Decorators

Defined in:
lib/decorators.rb,
lib/decorators/paths.rb,
lib/decorators/railtie.rb

Defined Under Namespace

Classes: Paths, Railtie

Class Method Summary collapse

Class Method Details

.decoratorsObject



18
19
20
# File 'lib/decorators.rb', line 18

def decorators
  paths.registered.map(&method(:find_decorators_in_path)).flatten.uniq
end

.load!(cache_classes) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/decorators.rb', line 5

def load!(cache_classes)
  decorators_with_argument_errors = []
  decorators.each do |decorator|
    load_decorator(decorator, cache_classes)
  rescue ArgumentError
    decorators_with_argument_errors << decorator
  end

  decorators_with_argument_errors.each do |decorator|
    load_decorator(decorator, cache_classes)
  end
end

.register!(*paths_to_register) ⇒ Object



22
23
24
25
26
# File 'lib/decorators.rb', line 22

def register!(*paths_to_register)
  paths_to_register.flatten.map do |path|
    paths.register! path
  end
end