ruby-3.0.0-preview2でMastodonを走らせようと思ったらchewyさんが
def create_type(index, target, options = {}, &block)
から
adapter = adapters.find { |klass| klass.accepts?(target) }.new(target, options)
みたいに呼んでるnewが
def initialize(target, **options)
@target = target
@options = options
end
みたいに定義されてて
ArgumentError: wrong number of arguments (given 2, expected 1)
になってキーワード引数の勉強しなくちゃわね
これは2.7.2と3.0.0-preview2の両方で完走するね
def m(arg, **opts)
p arg
p opts
end
m('arg', key: 'value')
m('arg', **{})