danno_ball_clock 0.0.0 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/clock.rb +11 -7
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc2c82de3913f0338c99b7db8770083ecc6e0682
|
4
|
+
data.tar.gz: 121c079f5a33de62946c2497a39791ae6e9a132a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54beb244fd87d7da5425a12904fcee3e9765724b52a7a2031bd33ab56a8b6eecce9d3bd0269fc6979461bed9707d7bdb860dbf088eeeb0243c05e342c6f5f87b
|
7
|
+
data.tar.gz: 1ffe67f6d97ba834f284645297d38ef3b344409e40f7d861554edf5f87ed5ffea6d653777915c5406fb3a934bacbbfcf86278078314d26a1e228aa615bbbf651
|
data/lib/clock.rb
CHANGED
@@ -2,11 +2,20 @@
|
|
2
2
|
require 'json'
|
3
3
|
###
|
4
4
|
# @author Dan Oberg <dan@cs1.com>
|
5
|
+
# @licence MIT
|
5
6
|
# @class Clock
|
7
|
+
# Useage: `ruby -Ilib ./bin/clock {27,0}` or `ruby -Ilib ./bin/clock {30,325}`
|
6
8
|
###
|
7
9
|
class Clock
|
8
10
|
###
|
9
|
-
# @method add_minute
|
11
|
+
# @method add_minute adds a ball from the begining of the main
|
12
|
+
# queue to the minute track. Once the minute track is full
|
13
|
+
# the ball will drop to the five minute track triggering in
|
14
|
+
# reverse order the minute track to deposit to the main queue.
|
15
|
+
# When the five minute track is full it will pass the next ball from
|
16
|
+
# from the main queue to the hour track which triggers the five min
|
17
|
+
# track to drop its balls in reverse order to the main queue. When
|
18
|
+
# hour track is full will drop balls in reverse order to the main queue.
|
10
19
|
###
|
11
20
|
def self.add_minute
|
12
21
|
if @min_track.length < 4
|
@@ -45,16 +54,11 @@ class Clock
|
|
45
54
|
end
|
46
55
|
|
47
56
|
###
|
48
|
-
# @param [Fixnum, Fixnum] runs clock with number of balls and optionally a runtime.
|
57
|
+
# @param [Fixnum, Fixnum] runs clock with number of balls to start with and optionally a runtime.
|
49
58
|
# @return [Json] json hash for min, five_min, hour and main queues. If no runtime
|
50
59
|
# is provided will calculate days tell que repeats.
|
51
60
|
###
|
52
61
|
def self.run_ball_clock(balls, run_time)
|
53
|
-
@min = []
|
54
|
-
@five_min = []
|
55
|
-
@hour = []
|
56
|
-
@main = []
|
57
|
-
@result = []
|
58
62
|
@current_que = []
|
59
63
|
@hours_passed = '0'.to_i
|
60
64
|
@repeat = false
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danno_ball_clock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danial Oberg
|
@@ -10,8 +10,8 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2015-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: A simple ball clock in ruby. Input number of
|
14
|
-
run time
|
13
|
+
description: A simple ball clock in ruby. Input the number of balls to start with
|
14
|
+
and optionally a run time
|
15
15
|
email: dan@cs1.com
|
16
16
|
executables:
|
17
17
|
- clock
|