Skip to content
Browse files

* 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
  • Loading branch information...
1 parent 5dad183 commit 8fbffe61cc35433cef210ce25708fa535d2cc9bf @ko1 ko1 committed Jun 20, 2013
Showing with 9 additions and 20 deletions.
  1. +5 −0 ChangeLog
  2. +4 −20 benchmark/bm_app_aobench.rb
View
5 ChangeLog
@@ -1,3 +1,8 @@
+Thu Jun 20 16:57:19 2013 Koichi Sasada <ko1@atdot.net>
+
+ * benchmark/bm_app_aobench.rb: use attr_accessor/reader instead of
+ defining methods.
+
Thu Jun 20 16:46:46 2013 Koichi Sasada <ko1@atdot.net>
* benchmark/bm_app_aobench.rb: added.
View
24 benchmark/bm_app_aobench.rb
@@ -17,12 +17,7 @@ def initialize(x, y, z)
@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 @@ def initialize(center, radius)
@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 @@ def initialize(org, dir)
@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 @@ def initialize
@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)

0 comments on commit 8fbffe6

Please sign in to comment.
Something went wrong with that request. Please try again.