From: ewfawefw3@... Date: 2018-06-25T21:10:15+00:00 Subject: [ruby-core:87634] [Ruby trunk Feature#14111] ArgumentErrorが発生した時メソッドのプロトタイプをメッセージに含む Issue #14111 has been updated by esjee (SJ Stoker). File argument_error.rb added ���������������������������������������https://github.com/nobu/ruby/tree/feature/14111-ArgumentError-attributes��������������������������������������������������������������� ��������������������������������������������������������������� ``` def foo(a, b = 3); end ``` ������������ ``` Method prototype: def foo1(a, b = 3) ``` ������������������������ nobu���������������������������`Method#parameters`��������������������������������������������������������������� ��������������������������������������������������������������������������������������������������������������������������������� ������������������������������������������������������ ``` def foo(a, b = (->() { Time.now.to_i }).call) def bar(a, b = (->() { $count ||= 0; $count += 1}).call) ``` `b`��������������������������������������������������������������������������� nobu���������������������������������������������������������������������������������������������������������������������: ``` $ cat kerk.rb class Foo def bar(a, b, c = 3, *all_the_args, d:, e: 7) end end Foo.new.bar $ ./ruby kerk.rb Traceback (most recent call last): 1: from kerk.rb:6:in `
' /home/esjee/src/ruby/kerk.rb:2:in `bar': wrong number of arguments (given 0, expected 2+; required keyword: d) (ArgumentError) Method parameters: a (required) b (required) c (optional) all_the_args (rest) d (required keyword) e (optional keyword) ``` ������������������������������������������������������������������������������������������������������������������������������������ nobu���������������������ruby���������������������gem������������������������������������������������������������������������������������������������������������������������������ ������������������������������������������������rb���������������nobu��������������������������������������������������������������������������������������� ---------------------------------------- Feature #14111: ArgumentError������������������������������������������������������������������������������ https://bugs.ruby-lang.org/issues/14111#change-72655 * Author: esjee (SJ Stoker) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- ��������������������������������������������������������������������������������������������������������������������� ������������������������������������������������������������������������������������������������������������������������������ ������������������������������������������������������ # Abstract ArgumentError��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� # Background ���������ArgumentError��������������������������������������� ``` [1] pry(main)> cat ./spec/kerk_class.rb class Kerk def foo1(a) end end [2] pry(main)> require './spec/kerk_class.rb' => true [3] pry(main)> Kerk.new.foo1 ArgumentError: wrong number of arguments (0 for 1) from /home/esjee/src/printprototype/spec/kerk_class.rb:2:in `foo1' ``` ��������������������������������������������������������������������������������������� ��������������������������������������������������������������������������������������������������������������������������������������������������������������� Ruby��������������������������������������������������������������������������������� # Proposal ArgumentError������������������������������������������������������������������������������ ��������� ``` [4] pry(main)> Kerk.new.foo1 ArgumentError: wrong number of arguments (0 for 1) Method prototype: def foo1(a) from /home/esjee/src/printprototype/spec/kerk_class.rb:2:in `foo1' ``` # Implementation https://github.com/esjee/PrintPrototype ��������������������������� https://github.com/esjee/PrintPrototype/blob/master/lib/printprototype/core_ext/argument_error.rb # Evaluation ��������������������������������������������������������������� * ������������������������������������������������������������������������������������������������������ * ��������������������������������������������������������������������������������������������������������������������������������� * Ruby���������������������������rb������������������������������������������������������������ * sentry-raven��������������������������������������� # Discussion ������������������������������������������������������������������������ ��������������������������������������� * ���������������feature���������������������? * ��������������������������������������������������������������������������������������������� # Summary ArgumentError������������������������������������������������������������������������������������������ ���������������gem������������������������������������������������������������������������������������������ ���������������������������Ruby���������������featue������������������������ ��������������������������������������������������������������� ---Files-------------------------------- add_receiver_and_method_name_to_argument_error_for_application_code.diff (4.5 KB) add_receiver_and_method_name_to_argument_error_for_application_code_2.diff (8.51 KB) argument_error.rb (897 Bytes) -- https://bugs.ruby-lang.org/ Unsubscribe: