Module: CoreSystemConfiguration::ClassMethods

Defined in:
lib/app/models/concerns/core_system_configuration.rb

Overview

Class methods for SystemConfiguration

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method) ⇒ Object

NOTE: Currently ignored Codacy issue: When using ‘method_missing’, fall back on ‘super’



61
62
63
64
65
66
67
# File 'lib/app/models/concerns/core_system_configuration.rb', line 61

def method_missing(method, ...)
  if configuration.respond_to?(method)
    configuration.send(method, ...)
  else
    super
  end
end

Instance Method Details

#configurationObject



54
55
56
# File 'lib/app/models/concerns/core_system_configuration.rb', line 54

def configuration
  SystemConfiguration.find_or_create_by!(environment: Rails.env)
end

#respond_to?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/app/models/concerns/core_system_configuration.rb', line 69

def respond_to?(method_name, include_private = false)
  super || configuration.respond_to?(method_name, include_private)
end

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


73
74
75
# File 'lib/app/models/concerns/core_system_configuration.rb', line 73

def respond_to_missing?(method_name, include_private = false)
  configuration.respond_to?(method_name, include_private) || super
end