27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/arrow/function.rb', line 27
def resolve_options(options)
return nil if options.nil?
return options if options.is_a?(FunctionOptions)
arrow_options_class = options_type&.to_class
if arrow_options_class
if arrow_options_class.respond_to?(:try_convert)
arrow_options = arrow_options_class.try_convert(options)
return arrow_options if arrow_options
end
arrow_options = (default_options || arrow_options_class.new)
else
arrow_options = default_options
end
return arrow_options if arrow_options.nil?
options.each do |key, value|
setter = :"#{key}="
next unless arrow_options.respond_to?(setter)
arrow_options.__send__(setter, value)
end
arrow_options
end
|