class ROM::Options::Definitions
Manage all available options
@api private
Public Class Methods
new()
click to toggle source
# File lib/rom/support/options.rb, line 105 def initialize @options = {} end
Public Instance Methods
define(option)
click to toggle source
# File lib/rom/support/options.rb, line 114 def define(option) @options[option.name] = option end
initialize_copy(source)
click to toggle source
Calls superclass method
# File lib/rom/support/options.rb, line 109 def initialize_copy(source) super @options = @options.dup end
names()
click to toggle source
# File lib/rom/support/options.rb, line 123 def names @options.keys end
process(object, options)
click to toggle source
# File lib/rom/support/options.rb, line 118 def process(object, options) ensure_known_options(options) each { |_, option| options.update option.transform(object, options) } end
Private Instance Methods
each(&block)
click to toggle source
# File lib/rom/support/options.rb, line 129 def each(&block) @options.each(&block) end
ensure_known_options(options)
click to toggle source
# File lib/rom/support/options.rb, line 133 def ensure_known_options(options) options.each_key do |name| @options.fetch(name) do fail InvalidOptionKeyError, "#{name.inspect} is not a valid option" end end end