Module: ROM::Configurable::Methods::DSL Private

Defined in:
lib/rom/support/configurable.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#setting(name, import: nil, inherit: false, join: false, default: Undefined, **options) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



182
183
184
185
186
187
188
189
190
191
192
# File 'lib/rom/support/configurable.rb', line 182

def setting(name, import: nil, inherit: false, join: false, default: Undefined, **options)
  if import
    setting_import(name, import, **options)
  elsif inherit
    setting(name, default: default, constructor: Constructors::Inherit.new(name), **options)
  elsif join
    setting(name, default: default, constructor: Constructors::Join.new(name), **options)
  else
    super(name, default: default, **options)
  end
end

#setting_import(name, setting) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



195
196
197
198
199
200
# File 'lib/rom/support/configurable.rb', line 195

def setting_import(name, setting)
  # TODO: it would be great if this could just be import.with(name: name)
  settings << setting.class.new(
    name, input: setting.input, default: setting.default, **setting.options
  )
end

#settingsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



203
204
205
# File 'lib/rom/support/configurable.rb', line 203

def settings
  _settings
end