module Sequel::Schema::ColumnOptionMerger

Private Instance Methods

_merge_column_options(defaults, opts) click to toggle source

Merge given options into the column's default options. For backwards compatibility, the options take priority, but in cases where the option value overrides the argument value, and the values are different, we warn as this is likely to be an error in the code.

   # File lib/sequel/database/schema_generator.rb
13 def _merge_column_options(defaults, opts)
14   defaults.merge!(opts) do |k, defv, v|
15     unless defv == v
16       # :nocov:
17       if RUBY_VERSION >= "3.2"
18       # :nocov:
19         caller_loc = Thread.each_caller_location do |loc|
20           break loc unless loc.path == __FILE__
21         end
22         caller_loc &&= "#{caller_loc.path}:#{caller_loc.lineno}: "
23       end
24       warn("#{caller_loc}#{k.inspect} option value (#{v.inspect}) overrides argument value (#{defv.inspect})")
25     end
26 
27     v
28   end
29 end