[前][次][番号順一覧][スレッド一覧]

ruby-changes:58963

From: Hiroshi <ko1@a...>
Date: Sat, 30 Nov 2019 08:00:59 +0900 (JST)
Subject: [ruby-changes:58963] 04511b994e (master): Remove re-define embedded error classes and extract argument on custom error classes

https://git.ruby-lang.org/ruby.git/commit/?id=04511b994e

From 04511b994e19de65fff84dd55a246842a2f9ad29 Mon Sep 17 00:00:00 2001
From: Hiroshi SHIBATA <hsbt@r...>
Date: Wed, 27 Nov 2019 12:11:34 +0900
Subject: Remove re-define embedded error classes and extract argument on
 custom error classes


diff --git a/lib/matrix.rb b/lib/matrix.rb
index 690f98f..0f4e1b2 100644
--- a/lib/matrix.rb
+++ b/lib/matrix.rb
@@ -15,18 +15,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/matrix.rb#L15
 require_relative "matrix/version"
 
 module ExceptionForMatrix # :nodoc:
-  class TypeError
-    def initialize(val)
-      "wrong argument type #{val} (expected #{val})"
-    end
-  end
-
-  class ArgumentError
-    def initialize(val)
-      "Wrong # of arguments(#{val} for #{val})"
-    end
-  end
-
   class ErrDimensionMismatch < StandardError
     def initialize
       super("\#{self.name} dimension mismatch")
@@ -40,14 +28,14 @@ module ExceptionForMatrix # :nodoc: https://github.com/ruby/ruby/blob/trunk/lib/matrix.rb#L28
   end
 
   class ErrOperationNotDefined < StandardError
-    def initialize(val)
-      super("Operation(#{val}) can\\'t be defined: #{val} op #{val}")
+    def initialize(op, sc, oc)
+      super("Operation(#{op}) can\\'t be defined: #{sc} op #{oc}")
     end
   end
 
   class ErrOperationNotImplemented < StandardError
-    def initialize(val)
-      super("Sorry, Operation(#{val}) not implemented: #{val} op #{val}")
+    def initialize(op, sc, oc)
+      super("Sorry, Operation(#{op}) not implemented: #{sc} op #{oc}")
     end
   end
 end
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]