class Bidgem::Auction
Public Instance Methods
chooseWinningBidder(min_bid,max_bid,cur_bid)
click to toggle source
# File lib/bidgem/auction.rb, line 49 def chooseWinningBidder(min_bid,max_bid,cur_bid) $winningBid = min_bid end
getBidValues(bid_val)
click to toggle source
# File lib/bidgem/auction.rb, line 35 def getBidValues(bid_val) @bid_val=bid_val.to_f $bids << @bid_val puts("SSSSS"+$bids.to_s) setBids($bids) end
setBids(bids)
click to toggle source
# File lib/bidgem/auction.rb, line 15 def setBids(bids) puts "Current time #{Time.now} and time value is #{$time}" sleep(10) $time += 1 puts "Current time now #{Time.now} and time value is #{$time}" $ary << sort(bids) puts("After sorting:"+$ary.to_s) index=(($ary.length) - 1) $min_bid = $ary.at(index) $max_bid = $ary.at(0) $cur_bid = $ary.at($ary.length) chooseWinningBidder($min_bid,$max_bid,$cur_bid) end
sort(bids)
click to toggle source
# File lib/bidgem/auction.rb, line 45 def sort(bids) $bids.dup.sort_by{ |h| h * -1 } end