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 # Skip core library methods implemented in Ruby 21 path = loc.path 22 break loc unless path == __FILE__ || (path && path.start_with?('<internal:')) 23 end 24 caller_loc &&= "#{caller_loc.path}:#{caller_loc.lineno}: " 25 end 26 warn("#{caller_loc}#{k.inspect} option value (#{v.inspect}) overrides argument value (#{defv.inspect})") 27 end 28 29 v 30 end 31 end