From 8fbffe61cc35433cef210ce25708fa535d2cc9bf Mon Sep 17 00:00:00 2001 From: ko1 Date: Thu, 20 Jun 2013 07:58:13 +0000 Subject: * benchmark/bm_app_aobench.rb: use attr_accessor/reader instead of defining methods. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ benchmark/bm_app_aobench.rb | 24 ++++-------------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4ce2d4d29d..e321afd334 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Jun 20 16:57:19 2013 Koichi Sasada + + * benchmark/bm_app_aobench.rb: use attr_accessor/reader instead of + defining methods. + Thu Jun 20 16:46:46 2013 Koichi Sasada * benchmark/bm_app_aobench.rb: added. diff --git a/benchmark/bm_app_aobench.rb b/benchmark/bm_app_aobench.rb index 4f15bbd2de..807349089f 100644 --- a/benchmark/bm_app_aobench.rb +++ b/benchmark/bm_app_aobench.rb @@ -17,12 +17,7 @@ class Vec @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 @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 @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 @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) -- cgit v1.2.3