bidgem 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 27e6ac4917bca3cf2261634fe12f631ef908bc60
4
- data.tar.gz: 8b99e55c2191ff26463572be471ae48c368e7f64
3
+ metadata.gz: ae629e6a4e87f3af15e7887c885ebfb3696b43c7
4
+ data.tar.gz: 4e8e86343bf6a0552d13508d81ac32a8a5c4a317
5
5
  SHA512:
6
- metadata.gz: 86facd06dd7a3edd70f9b1700d3df5b13695c0a8d4bc8daca6436b8dfcdb5c869532943d35bcd043cae772401571cb7c235d7ec017be243e703de5426d57fa97
7
- data.tar.gz: '0289eb314df5c2dce8cf758d0b2a71301d6bdf18b869ce524a9cf5e4f7f7de8b14e1f393932158813de48e3cb4851ad28de7ae4013d8416031f5b71ffa675621'
6
+ metadata.gz: cadd8e79a3230f791445c90f42b99429d9b9207cfd50192d0cd1047f93ec3e0af14008dcfe4195b8797db65ca6676de4c1d7c41ff6c3d9c2e031d3c520254fe6
7
+ data.tar.gz: 32d017f1061d1ff4f60fce9e94edcd7d8c6834c55f7ed6b0ca11b885fa9cf6a2c03fedeee90379b4069a0585309a4e15d27e36cf9b4b35c4fe01471ae42e92d6
@@ -2,23 +2,27 @@ require 'rails'
2
2
 
3
3
  module Bidgem
4
4
  class Auction
5
- $min_bid=0
5
+ $min_bid=0
6
6
  $max_bid=0
7
7
  $cur_bid=0
8
- $bids = Array.new()
8
+ $bids =Array.new
9
+ $ary=Array.new
9
10
  $time=0
10
- $ary=Array.new()
11
+
11
12
  $winningBid = 0
12
13
 
13
14
 
14
- def setBids()
15
+ def setBids(bids)
16
+
15
17
  puts "Current time #{Time.now} and time value is #{$time}"
16
18
  sleep(10)
17
19
  $time += 1
18
20
  puts "Current time now #{Time.now} and time value is #{$time}"
19
-
20
- $ary << sort($bids)
21
- $min_bid = $ary.at($ary.length + 1)
21
+
22
+ $ary << sort(bids)
23
+ puts("After sorting:"+$ary.to_s)
24
+ index=(($ary.length) - 1)
25
+ $min_bid = $ary.at(index)
22
26
  $max_bid = $ary.at(0)
23
27
  $cur_bid = $ary.at($ary.length)
24
28
 
@@ -29,7 +33,10 @@ module Bidgem
29
33
 
30
34
 
31
35
  def getBidValues(bid_val)
32
- $bids << bid_val
36
+ @bid_val=bid_val.to_f
37
+
38
+ $bids << @bid_val
39
+ puts("SSSSS"+$bids.to_s)
33
40
  setBids($bids)
34
41
  end
35
42
 
@@ -40,13 +47,8 @@ def sort(bids)
40
47
  end
41
48
 
42
49
  def chooseWinningBidder(min_bid,max_bid,cur_bid)
43
- if $time == 23
44
50
  $winningBid = min_bid
45
- end
46
51
  end
47
- t = Auction.new
48
- t.setBids
49
-
50
52
 
51
53
 
52
54
  end
@@ -1,3 +1,3 @@
1
1
  module Bidgem
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bidgem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bhavna Thakur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-12 00:00:00.000000000 Z
11
+ date: 2019-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler