secret_knock 0.1.2 → 0.2.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
2
  SHA1:
3
- metadata.gz: f563e31f57fd2e069234691672ca82d30ac7f408
4
- data.tar.gz: eeef07610f8195bbf7e2dfaf6fbb9cf2bd2675dc
3
+ metadata.gz: 81911ddcaec334a9e82098526bc56782fb79b267
4
+ data.tar.gz: 6741ca05a53298891ba58164bcdd4ac389991cbb
5
5
  SHA512:
6
- metadata.gz: 2290017d47f7026c92c34491f888a858a694238d9158c1c81c1dc9e6359c28ad17abbea8a40cb1fc632bcfdf18a6f828beb41c5d53cfe529d2076e9e97fe7ff3
7
- data.tar.gz: 84f1cf5bae8b3a22e960210c961795fe70f0508218996431315ff5348b6f79f97300107cb8b87b5e4b5e253c464d4ed7a270766b47b4d7f468cf2b2728bdc433
6
+ metadata.gz: d94dc502275011b03199af610464cacc79698963ad3bce696fee40153e55d6944ea1f446235951f55ca7f84284bd572d1055754bb82395ed9d1c5be402df9c45
7
+ data.tar.gz: af9d6643f0956f0ef866c10629bbd65e4cbb28110b2930071bae008b8e8774deab903798a5ee49d2e6b75d3b9beed461e2df5eeff3aca745c27f41e607cbac05
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/secret_knock.rb CHANGED
@@ -7,7 +7,8 @@ class SecretKnock
7
7
 
8
8
  attr_reader :h, :message, :listening
9
9
 
10
- def initialize(verbose: true, external: nil)
10
+ def initialize(verbose: true, external: nil,
11
+ short_delay: 0.35, long_delay: 0.9)
11
12
 
12
13
  @verbose, @external = verbose, external
13
14
 
@@ -21,7 +22,7 @@ class SecretKnock
21
22
  i = 0
22
23
  a = ([' '] + keys + ('1'..'9').to_a + ['0','<backspace>']).map do |x|
23
24
  i += 1
24
- i += 1 if i.to_s[-1] == '0'
25
+ i += 1 while i.to_s[-1].to_i > 6 or i.to_s[-1].to_i == 0
25
26
  [x, i]
26
27
  end
27
28
 
@@ -30,18 +31,19 @@ class SecretKnock
30
31
 
31
32
  @h = (a.take(27).sort_by(&:first) + a[27..-1]).to_h
32
33
 
33
- #=> h contains the following
34
+ #> h contains the following
34
35
  # {
35
- # " "=>1, "a"=>4, "b"=>23, "c"=>14, "d"=>12, "e"=>2, "f"=>18, "g"=>19,
36
- # "h"=>9, "i"=>6, "j"=>26, "k"=>25, "l"=>13, "m"=>16, "n"=>7, "o"=>5,
37
- # "p"=>22, "q"=>28, "r"=>11, "s"=>8, "t"=>3, "u"=>15, "v"=>24, "w"=>17,
38
- # "x"=>27, "y"=>21, "z"=>29, "1"=>31, "2"=>32, "3"=>33, "4"=>34, "5"=>35,
39
- # "6"=>36, "7"=>37, "8"=>38, "9"=>39, "0"=>41, "<backspace>"=>42
36
+ # " "=>1, "a"=>4, "b"=>33, "c"=>21, "d"=>15, "e"=>2, "f"=>25, "g"=>26,
37
+ # "h"=>13, "i"=>6, "j"=>36, "k"=>35, "l"=>16, "m"=>23, "n"=>11, "o"=>5,
38
+ # "p"=>32, "q"=>42, "r"=>14, "s"=>12, "t"=>3, "u"=>22, "v"=>34, "w"=>24,
39
+ # "x"=>41, "y"=>31, "z"=>43, "1"=>44, "2"=>45, "3"=>46, "4"=>51, "5"=>52,
40
+ # "6"=>53, "7"=>54, "8"=>55, "9"=>56, "0"=>61, "<backspace>"=>62
40
41
  # }
42
+
41
43
 
42
44
  @hb = h.invert
43
45
 
44
- @short_delay, @long_delay = 0.35, 0.9 # seconds
46
+ @short_delay, @long_delay = short_delay, long_delay # seconds
45
47
  @listening = false
46
48
 
47
49
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: secret_knock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file