morsecode 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/morsecode.rb +79 -0
- metadata +27 -24
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9531b3d59382eae897f5fbb4254e0528e537a30ae65e7480d49c49f5434cc393
|
4
|
+
data.tar.gz: 184dff75b6fc74e3be61ede7dc40232b666cab4d018d0d413491e052ff6426a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2888551d8aa551565c78141eca7ba9b0e71eda9988343df1a1c7be1af327903d32067305539e10b3239fb87708304f5f9fd29d3c6fe0e1d600c1547148da12a
|
7
|
+
data.tar.gz: 03104c2aa9cdcb5b56531dcdb5c6289e5cb508e9322a264c082d64a645ea56b3d6c9fe345434eb4da46a102d8d05a81e53877d89b08507979c2eb09fbe815c2d
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/morsecode.rb
CHANGED
@@ -32,3 +32,82 @@ class MorseCode
|
|
32
32
|
end
|
33
33
|
|
34
34
|
end
|
35
|
+
|
36
|
+
class MorseCodeInteractive
|
37
|
+
|
38
|
+
def initialize(dash: 'D', dot: 'C', separator: 'B', terminator: "\r",
|
39
|
+
debug: false)
|
40
|
+
|
41
|
+
@keys = {
|
42
|
+
dash: dash,
|
43
|
+
dot: dot,
|
44
|
+
separator: separator,
|
45
|
+
terminator: terminator
|
46
|
+
}
|
47
|
+
|
48
|
+
@mc = ''
|
49
|
+
@debug = debug
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
def input(c)
|
54
|
+
|
55
|
+
h = {
|
56
|
+
dash: :dash,
|
57
|
+
dot: :dot,
|
58
|
+
separator: :separator,
|
59
|
+
terminator: :submit
|
60
|
+
}
|
61
|
+
|
62
|
+
if @debug then
|
63
|
+
puts 'c: ' + c.inspect
|
64
|
+
puts '@keys.invert: ' + @keys.invert.inspect
|
65
|
+
end
|
66
|
+
|
67
|
+
key = @keys.invert[c]
|
68
|
+
puts 'key: ' + key.inspect if @debug
|
69
|
+
found = h[key]
|
70
|
+
puts 'found: ' + found.inspect if @debug
|
71
|
+
method(found).call if found
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
def on_dash() end
|
76
|
+
def on_dot() end
|
77
|
+
|
78
|
+
def on_separator(c)
|
79
|
+
puts 'c: ' + c.inspect
|
80
|
+
end
|
81
|
+
|
82
|
+
def on_submit(s)
|
83
|
+
puts 's: ' + s.inspect
|
84
|
+
end
|
85
|
+
|
86
|
+
private
|
87
|
+
|
88
|
+
def dash()
|
89
|
+
@mc += '1'
|
90
|
+
on_dash()
|
91
|
+
end
|
92
|
+
|
93
|
+
def dot()
|
94
|
+
@mc += '2'
|
95
|
+
on_dot()
|
96
|
+
end
|
97
|
+
|
98
|
+
def separator()
|
99
|
+
|
100
|
+
@mc += @mc[-1] =='4' ? '5' : '4'
|
101
|
+
s = MorseCode.new(@mc).to_s[-1]
|
102
|
+
on_separator(s)
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
def submit()
|
107
|
+
|
108
|
+
s = MorseCode.new(@mc).to_s
|
109
|
+
on_submit(s)
|
110
|
+
@mc = ''
|
111
|
+
|
112
|
+
end
|
113
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: morsecode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,28 +10,32 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|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
25
|
+
AaOBijCBhzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUPZAE7kvw
|
26
|
+
79wKRKswwVUkuJS2s+cwJgYDVR0RBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
|
27
|
+
c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
|
28
|
+
BgkqhkiG9w0BAQsFAAOCAYEAd/DTIYbYXdU7QQfmqbdgaNrr/n57hhIswx1pMdEc
|
29
|
+
MXPHWe39usv/RgbSJuBjadPCeCJRPbW/YubSNske7RpmutJLZUD3kC0uPw6qDAXZ
|
30
|
+
3bdNncU1OPpINaHayzqrWZ0cBNnasfhBifQsfdlvscjXrFdyEUuZQXpDGPP3qZ/m
|
31
|
+
g+YR+pkeur6aGHCw/ErcHnEtrtnpdNguOXbOdG6+EzkIIeSpNM/xX9+tGYdvlDLb
|
32
|
+
OuWmY76orlEZxmyTxKDJZFx8p1mapkV/cr+WyKfhv1uA+JhLyVvN5371nU8SjYxd
|
33
|
+
Wc3pB68fOmJYkP6bcDPwQ1uyCCqwFc1AvvO/UHdhiWZkKbc7zfZAXWvFobEsVYeU
|
34
|
+
5LeyKFGetyniLBdWxBChfduYLz+tpdIl1btHgYjKlpceL2qQMNk70cm3brhIx+zO
|
35
|
+
BiIQYk4Yg7Z1xPpIQn4NDFtV0Ckp0l1OGYo6FkEfKcmMwITUlW/WFczRgkBRKL/u
|
36
|
+
NCsP9YJ3ABrU9A8v53Glv5S6
|
33
37
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
38
|
+
date: 2019-05-24 00:00:00.000000000 Z
|
35
39
|
dependencies: []
|
36
40
|
description:
|
37
41
|
email: james@jamesrobertson.eu
|
@@ -59,8 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
63
|
- !ruby/object:Gem::Version
|
60
64
|
version: '0'
|
61
65
|
requirements: []
|
62
|
-
|
63
|
-
rubygems_version: 2.6.8
|
66
|
+
rubygems_version: 3.0.1
|
64
67
|
signing_key:
|
65
68
|
specification_version: 4
|
66
69
|
summary: Transforms Morse code to a string, or a string into Morse code
|
metadata.gz.sig
CHANGED
Binary file
|