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 +4 -4
- data/lib/bidgem/auction.rb +15 -13
- data/lib/bidgem/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae629e6a4e87f3af15e7887c885ebfb3696b43c7
|
4
|
+
data.tar.gz: 4e8e86343bf6a0552d13508d81ac32a8a5c4a317
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cadd8e79a3230f791445c90f42b99429d9b9207cfd50192d0cd1047f93ec3e0af14008dcfe4195b8797db65ca6676de4c1d7c41ff6c3d9c2e031d3c520254fe6
|
7
|
+
data.tar.gz: 32d017f1061d1ff4f60fce9e94edcd7d8c6834c55f7ed6b0ca11b885fa9cf6a2c03fedeee90379b4069a0585309a4e15d27e36cf9b4b35c4fe01471ae42e92d6
|
data/lib/bidgem/auction.rb
CHANGED
@@ -2,23 +2,27 @@ require 'rails'
|
|
2
2
|
|
3
3
|
module Bidgem
|
4
4
|
class Auction
|
5
|
-
|
5
|
+
$min_bid=0
|
6
6
|
$max_bid=0
|
7
7
|
$cur_bid=0
|
8
|
-
|
8
|
+
$bids =Array.new
|
9
|
+
$ary=Array.new
|
9
10
|
$time=0
|
10
|
-
|
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
|
-
|
21
|
-
|
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
|
-
|
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
|
data/lib/bidgem/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2019-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|