Class: Sinclair::Settable::Builder Private

Inherits:
Sinclair show all
Defined in:
lib/sinclair/settable/builder.rb

Overview

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

Env setting methods builder

This builder does the magic of adding methods that will fetch variables from env or a default value

Author:

  • darthjee

Constant Summary

Constants inherited from Sinclair

VERSION

Instance Attribute Summary

Attributes inherited from Sinclair

#klass

Attributes included from OptionsParser

#options

Instance Method Summary collapse

Methods inherited from Sinclair

#add_class_method, #add_method, #build, build, #eval_and_add_method

Methods included from ClassMethods

#build

Methods included from OptionsParser

#options_object

Constructor Details

#initialize(klass, *settings_name, **options) ⇒ Builder

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.

Returns a new instance of Builder.

Parameters:

  • klass (Class)

    Setting class where the methods will be added to

  • settings_name (Array<Symbol>)

    list of all settings to be added

  • options (Hash)

    Options of setting.

    Each settable might have their own set options defined in Settable.read_with, and then passed to the buildr on Settable#setting_with_options

Options Hash (**options):

  • type (Symbol)

    type to cast the value fetched

  • default (Object)

    Default value



24
25
26
27
28
29
30
# File 'lib/sinclair/settable/builder.rb', line 24

def initialize(klass, *settings_name, **options)
  super(klass, **options)

  @settings = settings_name

  add_all_methods
end