Module: WaterDrop::Configurable::ClassMethods

Defined in:
lib/waterdrop/configurable.rb

Overview

Class related methods

Instance Method Summary collapse

Instance Method Details

#configNode

Returns root node for the settings.

Returns:

  • (Node)

    root node for the settings



48
49
50
51
52
53
54
55
56
57
# File 'lib/waterdrop/configurable.rb', line 48

def config
  return @config if @config

  # This will handle inheritance
  @config = if superclass.respond_to?(:config)
              superclass.config.deep_dup
            else
              Node.new(:root)
            end
end

#configure(&block) ⇒ Object

Allows for a per class configuration (if needed)

Parameters:

  • block (Proc)

    block for configuration



61
62
63
# File 'lib/waterdrop/configurable.rb', line 61

def configure(&block)
  config.configure(&block)
end

#settingObject

Pipes the settings setup to the config root node



66
67
68
# File 'lib/waterdrop/configurable.rb', line 66

def setting(...)
  config.setting(...)
end