module ROM::Options::ClassMethods
@api private
Attributes
option_definitions[RW]
Available options
@return [Definitions]
@api private
Public Instance Methods
inherited(descendant)
click to toggle source
@api private
Calls superclass method
# File lib/rom/support/options.rb, line 170 def inherited(descendant) descendant.option_definitions = option_definitions.dup super end
option(name, settings = {})
click to toggle source
Defines an option
@param [Symbol] name option name
@param [Hash] settings option settings @option settings [Class] :type Restrict option type. Default: Object
@option settings [Boolean] :reader Define a reader? Default: false
@option settings [Array] :allow Allow certain values. Default: Allow anything @option settings [Object] :default Set default value for missing option @option settings [Proc] :coercer Set coercer for assigned option
@api public
# File lib/rom/support/options.rb, line 163 def option(name, settings = {}) option = Option.new(name, settings) option_definitions.define(option) attr_reader(name) if option.reader end