Class: Sinclair::Options::Builder Private

Inherits:
Sinclair show all
Defined in:
lib/sinclair/options/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.

Option Class Builder

This class builds methods for options objects

Author:

  • Darthjee

Constant Summary

Constants inherited from Sinclair

VERSION

Instance Attribute Summary

Attributes inherited from Sinclair

#klass

Attributes included from Sinclair::OptionsParser

#options

Instance Method Summary collapse

Methods inherited from Sinclair

#add_class_method, #add_method, build, #eval_and_add_method

Methods included from Sinclair::OptionsParser

#options_object

Constructor Details

#initialize(klass, *options) ⇒ Builder #initialize(klass, *options, **defaults) ⇒ 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.

Overloads:

  • #initialize(klass, *options) ⇒ Builder

    Parameters:

    • klass (Class)

      options class to receive methods

    • options (Array<Symbol>)

      list of accepted options

  • #initialize(klass, *options, **defaults) ⇒ Builder

    Parameters:

    • klass (Class)

      options class to receive methods

    • options (Array<Symbol>)

      list of accepted options

    • defaults (Hash<Symbol,Object>)

      default options hash



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

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

  @attributes = Sinclair::InputHash.input_hash(*options)
end

Instance Method Details

#buildArray<MethodDefinition>

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.

Finish building options

Add options to allowed options and adds all methods

Returns:

See Also:



37
38
39
40
41
42
# File 'lib/sinclair/options/builder.rb', line 37

def build
  add_all_methods
  add_filds_to_equals

  super
end