Class: LazyNames::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/lazy_names/logger.rb

Class Method Summary collapse

Class Method Details

.warn_duplicate_definition(errors, config_path) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/lazy_names/logger.rb', line 20

def warn_duplicate_definition(errors, config_path)
  return if errors.empty?

  message = <<~MSG
    Error loading lazy_names gem.
    Found #{errors.size} already defined constants.
    Using same lazy names for different constants may lead to unexpected results
    Avoid duplications in your config file.
    #{config_path}
    \n
  MSG

  warn(message)
end

.warn_empty_definitions(errors, config_path) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/lazy_names/logger.rb', line 35

def warn_empty_definitions(errors, config_path)
  return unless errors

  message = <<~MSG
    Error loading lazy_names gem.
    Seems like you misspelled namespace in config.
    #{config_path}
    Please ensure word definitions exists in config
    or check .lazy_names.tt.yml for consistency.
  MSG

  warn(message)
end

.warn_undefined(errors, config_path) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/lazy_names/logger.rb', line 6

def warn_undefined(errors, config_path)
  return if errors.empty?

  message = <<~MSG
    Error loading lazy_names gem.
    Found #{errors.size} undefined constants.
    Please check spelling for #{errors.join(', ')}
    #{config_path}
    \n
  MSG

  warn(message)
end