Class: ROM::Options::Definitions Private

Inherits:
Object
  • Object
show all
Defined in:
lib/rom/support/options.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.

Manage all available options

Instance Method Summary collapse

Constructor Details

#initializeDefinitions

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 Definitions.



83
84
85
# File 'lib/rom/support/options.rb', line 83

def initialize
  @options = {}
end

Instance Method Details

#define(option) ⇒ 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.



92
93
94
# File 'lib/rom/support/options.rb', line 92

def define(option)
  @options[option.name] = option
end

#initialize_copy(source) ⇒ 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.



87
88
89
90
# File 'lib/rom/support/options.rb', line 87

def initialize_copy(source)
  super
  @options = @options.dup
end

#namesObject

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.



112
113
114
# File 'lib/rom/support/options.rb', line 112

def names
  @options.keys
end

#process(object, 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.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/rom/support/options.rb', line 96

def process(object, options)
  ensure_known_options(options)

  each do |name, option|
    if option.default? && !options.key?(name)
      options[name] = option.default_value(object)
    end

    if options.key?(name)
      validate_option_value(option, name, options[name])
    end

    option.assign_reader_value(object, options[name]) if option.reader?
  end
end