Class: Uses::CircularDependency::BaseNotifier

Inherits:
Object
  • Object
show all
Defined in:
lib/uses/circular_dependency/base_notifier.rb

Direct Known Subclasses

IgnoreNotifier, LogNotifer, RaiseErrorNotifier

Instance Method Summary collapse

Constructor Details

#initialize(uses_method_args, path_to_dependency) ⇒ BaseNotifier

Returns a new instance of BaseNotifier.



4
5
6
7
8
9
10
11
# File 'lib/uses/circular_dependency/base_notifier.rb', line 4

def initialize(uses_method_args, path_to_dependency)
  path = if path_to_dependency.empty?
           nil
         else
           " via #{path_to_dependency.map(&:to_s).join(',')}"
         end
  @message =  "#{uses_method_args.klass_being_used} and #{uses_method_args.klass_with_uses} have a circular dependency#{path}. This may cause unforseen issues, or just be generally confusing"
end

Instance Method Details

#notify!Object



13
14
15
# File 'lib/uses/circular_dependency/base_notifier.rb', line 13

def notify!
  raise "subclass must implement"
end