module UmbrellioUtils

Constants

GLOBAL_MUTEX
VERSION

Public Instance Methods

config() click to toggle source

rubocop:disable Style/ClassVars

# File lib/umbrellio_utils.rb, line 18
def config
  synchronize do
    @@config ||= Struct
      .new(:store_table_name, :http_client_name, keyword_init: true)
      .new(**default_settings)
  end
end
configure() { |config| ... } click to toggle source

rubocop:enable Style/ClassVars

# File lib/umbrellio_utils.rb, line 28
def configure
  synchronize { yield config }
end
extend_util!(module_name, &block) click to toggle source
# File lib/umbrellio_utils.rb, line 32
def extend_util!(module_name, &block)
  const = UmbrellioUtils.const_get(module_name)
  synchronize { const.class_eval(&block) }
end
included(othermod) click to toggle source
Calls superclass method
# File lib/umbrellio_utils.rb, line 12
def included(othermod)
  super
  othermod.extend(self)
end

Private Instance Methods

default_settings() click to toggle source
# File lib/umbrellio_utils.rb, line 39
def default_settings
  {
    store_table_name: :store,
    http_client_name: :application_httpclient,
  }
end
synchronize() { |: synchronize(&block)| ... } click to toggle source
# File lib/umbrellio_utils.rb, line 46
def synchronize(&block)
  GLOBAL_MUTEX.owned? ? yield : GLOBAL_MUTEX.synchronize(&block)
end