Skip to content

Commit

Permalink
p.140 replace temp "a_base_price" with query.
Browse files Browse the repository at this point in the history
  • Loading branch information
kono committed May 22, 2010
1 parent 4f374a7 commit 13bdff4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions chapter6/Replace_Temp_with_Query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ def initialize(quantity, price)


def price
a_base_price = base_price
if a_base_price >1000
if base_price >1000
discount_factor = 0.95
else
discount_factor = 0.98
end
a_base_price * discount_factor
base_price * discount_factor
end

def base_price
Expand Down

0 comments on commit 13bdff4

Please sign in to comment.