diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-20 07:58:13 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-20 07:58:13 +0000 |
commit | 8fbffe61cc35433cef210ce25708fa535d2cc9bf (patch) | |
tree | 29184897a9c135c071d2cc9e7a41068c33d11a1c /benchmark/bm_app_aobench.rb | |
parent | 5dad18386e6409eea6821874f19109eed8e4667f (diff) | |
download | ruby-8fbffe61cc35433cef210ce25708fa535d2cc9bf.tar.gz |
* 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
Diffstat (limited to 'benchmark/bm_app_aobench.rb')
-rw-r--r-- | benchmark/bm_app_aobench.rb | 24 |
1 files changed, 4 insertions, 20 deletions
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) |