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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 154b7940a01897d2da7e51546dfd2dff6ea380e8
4
- data.tar.gz: 10b9a0faca29163c68224800a801a5a3da84ddf2
2
+ SHA256:
3
+ metadata.gz: 9531b3d59382eae897f5fbb4254e0528e537a30ae65e7480d49c49f5434cc393
4
+ data.tar.gz: 184dff75b6fc74e3be61ede7dc40232b666cab4d018d0d413491e052ff6426a0
5
5
  SHA512:
6
- metadata.gz: 557c2166851be12bb1cd2996ba896adf64d761c46ee71939de14123a16212e84077f8ef74c5c3ee0e93095e59253619ad8b08348d6e8def540241f5ebb883040
7
- data.tar.gz: 40e42d3f162301bfecdeabc876f3d4e49ad9a91660ae88aed57e127c0d90aa43facd4645eaf6574cbceb9a44cd965578ff084f70328de681c283e6a1a75f9a00
6
+ metadata.gz: a2888551d8aa551565c78141eca7ba9b0e71eda9988343df1a1c7be1af327903d32067305539e10b3239fb87708304f5f9fd29d3c6fe0e1d600c1547148da12a
7
+ data.tar.gz: 03104c2aa9cdcb5b56531dcdb5c6289e5cb508e9322a264c082d64a645ea56b3d6c9fe345434eb4da46a102d8d05a81e53877d89b08507979c2eb09fbe815c2d
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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.2.1
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
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
- YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
- 8ixkARkWAmV1MB4XDTE3MDIwNzE4MTYxNFoXDTE4MDIwNzE4MTYxNFowSDESMBAG
16
- A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
- EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQ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utJLZUD3kC0uPw6qDAXZ
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: 2017-02-07 00:00:00.000000000 Z
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
- rubyforge_project:
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