module ROM::Initializer::DefineWithHook
@api private
Public Instance Methods
__define_with__()
click to toggle source
@api private
# File lib/rom/initializer.rb, line 25 def __define_with__ seq_names = dry_initializer .definitions .reject { |_, d| d.option } .keys .join(', ') seq_names << ', ' unless seq_names.empty? undef_method(:with) if method_defined?(:with) class_eval(<<-RUBY, __FILE__, __LINE__ + 1) def with(**new_options) if new_options.empty? self else self.class.new(#{seq_names}**options, **new_options) end end RUBY end
option(*)
click to toggle source
@api private
Calls superclass method
# File lib/rom/initializer.rb, line 17 def option(*) super.tap do __define_with__ unless method_defined?(:with) end end
param(*)
click to toggle source
@api private
Calls superclass method
# File lib/rom/initializer.rb, line 11 def param(*) super.tap { __define_with__ } end