lib/rom/mapper/dsl.rb in rom-0.6.2 vs lib/rom/mapper/dsl.rb in rom-0.7.0

- old
+ new

@@ -25,10 +25,23 @@ klass.instance_variable_set('@attributes', nil) klass.instance_variable_set('@header', nil) klass.instance_variable_set('@dsl', nil) end + # include a registered plugin in this mapper + # + # @param [Symbol] plugin + # @param [Hash] options + # @option options [Symbol] :adapter (:default) first adapter to check for plugin + # + # @api public + def use(plugin, options = {}) + adapter = options.fetch(:adapter, :default) + + ROM.plugin_registry.mappers.fetch(plugin, adapter).apply_to(self) + end + # Return base_relation used for creating mapper registry # # This is used to "gather" mappers under same root name # # @api private @@ -50,19 +63,25 @@ # @api private def header @header ||= dsl.header end + # @api private + def respond_to_missing?(name, _include_private = false) + dsl.respond_to?(name) || super + end + private # Return default Attribute DSL options based on settings of the mapper # class # # @api private def options { prefix: prefix, prefix_separator: prefix_separator, - symbolize_keys: symbolize_keys } + symbolize_keys: symbolize_keys, + reject_keys: reject_keys } end # Return default attributes that might have been inherited from the # superclass #