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

ruby-changes:29434

From: ko1 <ko1@a...>
Date: Thu, 20 Jun 2013 16:58:31 +0900 (JST)
Subject: [ruby-changes:29434] ko1:r41486 (trunk): * benchmark/bm_app_aobench.rb: use attr_accessor/reader instead of

ko1	2013-06-20 16:58:13 +0900 (Thu, 20 Jun 2013)

  New Revision: 41486

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41486

  Log:
    * benchmark/bm_app_aobench.rb: use attr_accessor/reader instead of
      defining methods.

  Modified files:
    trunk/ChangeLog
    trunk/benchmark/bm_app_aobench.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41485)
+++ ChangeLog	(revision 41486)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jun 20 16:57:19 2013  Koichi Sasada  <ko1@a...>
+
+	* benchmark/bm_app_aobench.rb: use attr_accessor/reader instead of
+	  defining methods.
+
 Thu Jun 20 16:46:46 2013  Koichi Sasada  <ko1@a...>
 
 	* benchmark/bm_app_aobench.rb: added.
Index: benchmark/bm_app_aobench.rb
===================================================================
--- benchmark/bm_app_aobench.rb	(revision 41485)
+++ benchmark/bm_app_aobench.rb	(revision 41486)
@@ -17,12 +17,7 @@ class Vec https://github.com/ruby/ruby/blob/trunk/benchmark/bm_app_aobench.rb#L17
     @z = z
   end
 
-  def x=(v); @x = v; end
-  def y=(v); @y = v; end
-  def z=(v); @z = v; end
-  def x; @x; end
-  def y; @y; end
-  def z; @z; end
+  attr_accessor :x, :y, :z
 
   def vadd(b)
     Vec.new(@x + b.x, @y + b.y, @z + b.z)
@@ -65,8 +60,7 @@ class Sphere https://github.com/ruby/ruby/blob/trunk/benchmark/bm_app_aobench.rb#L60
     @radius = radius
   end
 
-  def center; @center; end
-  def radius; @radius; end
+  attr_reader :center, :radius
 
   def intersect(ray, isect)
     rs = ray.org.vsub(@center)
@@ -129,10 +123,7 @@ class Ray https://github.com/ruby/ruby/blob/trunk/benchmark/bm_app_aobench.rb#L123
     @dir = dir
   end
 
-  def org; @org; end
-  def org=(v); @org = v; end
-  def dir; @dir; end
-  def dir=(v); @dir = v; end
+  attr_accessor :org, :dir
 end
 
 class Isect
@@ -143,14 +134,7 @@ class Isect https://github.com/ruby/ruby/blob/trunk/benchmark/bm_app_aobench.rb#L134
     @n = Vec.new(0.0, 0.0, 0.0)
   end
 
-  def t; @t; end
-  def t=(v); @t = v; end
-  def hit; @hit; end
-  def hit=(v); @hit = v; end
-  def pl; @pl; end
-  def pl=(v); @pl = v; end
-  def n; @n; end
-  def n=(v); @n = v; end
+  attr_accessor :t, :hit, :pl, :n
 end
 
 def clamp(f)

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

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