Sha256: 54c0cc5090a81839ee84b40e38e7763f1ff342619e0695988eb66f9c53568b1b

Contents?: true

Size: 584 Bytes

Versions: 6

Compression:

Stored size: 584 Bytes

Contents

# frozen_string_literal: true

module UltraSettings
  # Helper module for setting up a class to use the config methods
  #
  # Usage:
  # class TestClass
  #   extend UltraSettings::ConfigHelper
  #   configuration_class TestConfiguration
  # end
  # TestClass.config => TestConfiguration.instance
  # TestClass.new.config => TestConfiguration.instance
  module ConfigHelper
    def configuration_class(config_class)
      define_singleton_method :config do
        config_class.instance
      end

      define_method :config do
        self.class.config
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ultra_settings-2.4.5 lib/ultra_settings/config_helper.rb
ultra_settings-2.4.4 lib/ultra_settings/config_helper.rb
ultra_settings-2.4.3 lib/ultra_settings/config_helper.rb
ultra_settings-2.4.2 lib/ultra_settings/config_helper.rb
ultra_settings-2.4.1 lib/ultra_settings/config_helper.rb
ultra_settings-2.4.0 lib/ultra_settings/config_helper.rb