konamio 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/konamio/key_map.rb +17 -0
- data/lib/konamio/sequence/listener.rb +1 -1
- data/lib/konamio/sequence/requisition.rb +1 -1
- data/lib/konamio/version.rb +1 -1
- data/lib/konamio.rb +1 -0
- data/test/konamio/key_map_test.rb +28 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64567479769f776f55124c2cc781254b13bb00d2
|
4
|
+
data.tar.gz: fce728a4fa000545e348f620e55d130acd192944
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f19d56779d7d3f2475ed57249b06b23990449325714d5f896fe33b61e00c76807d38cd8ed1c699f271959c25f1544ffc83a46afdb1c55b9fe7f6c1a95e285cc6
|
7
|
+
data.tar.gz: cc2ee72ba0372c95271e8fdf3975171fbbf339826491afdeb4f1394c96bbd5027a69173076aa7474efe79e29c49ac6cdb4573cb739de43048f061251890400cb
|
data/.gitignore
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Konamio
|
2
|
+
module KeyMap
|
3
|
+
def self.sequence(key)
|
4
|
+
{
|
5
|
+
space: " ",
|
6
|
+
tab: "\t",
|
7
|
+
return: "\r",
|
8
|
+
line_feed: "\n",
|
9
|
+
escape: "\e",
|
10
|
+
up: "\e[A",
|
11
|
+
down: "\e[B",
|
12
|
+
right: "\e[C",
|
13
|
+
left: "\e[D"
|
14
|
+
}.fetch(key) { key }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -5,7 +5,7 @@ module Konamio
|
|
5
5
|
options = {
|
6
6
|
speaker: Konamio::Prompt,
|
7
7
|
listener: Konamio::Sequence::Listener,
|
8
|
-
sequence: [
|
8
|
+
sequence: [:up,:up,:down,:down,:left,:right,:left,:right,"B","A"],
|
9
9
|
prompt: "Enter konami code (or hit escape)",
|
10
10
|
confirmation: "Good job, you."
|
11
11
|
}.merge(options)
|
data/lib/konamio/version.rb
CHANGED
data/lib/konamio.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
require "minitest_helper"
|
2
|
+
|
3
|
+
describe Konamio::KeyMap do
|
4
|
+
before do
|
5
|
+
@subject = Konamio::KeyMap
|
6
|
+
end
|
7
|
+
|
8
|
+
it "returns the input provided if no matches are found" do
|
9
|
+
assert @subject.sequence(:konami) == :konami
|
10
|
+
end
|
11
|
+
|
12
|
+
it "recognizes a number of symbols" do
|
13
|
+
[
|
14
|
+
:up,
|
15
|
+
:down,
|
16
|
+
:left,
|
17
|
+
:right,
|
18
|
+
:space,
|
19
|
+
:tab,
|
20
|
+
:return,
|
21
|
+
:line_feed,
|
22
|
+
:escape
|
23
|
+
].each do |symbol|
|
24
|
+
assert @subject.sequence(symbol) != symbol
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: konamio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tad Hosford
|
@@ -80,10 +80,12 @@ files:
|
|
80
80
|
- Rakefile
|
81
81
|
- konamio.gemspec
|
82
82
|
- lib/konamio.rb
|
83
|
+
- lib/konamio/key_map.rb
|
83
84
|
- lib/konamio/prompt.rb
|
84
85
|
- lib/konamio/sequence/listener.rb
|
85
86
|
- lib/konamio/sequence/requisition.rb
|
86
87
|
- lib/konamio/version.rb
|
88
|
+
- test/konamio/key_map_test.rb
|
87
89
|
- test/konamio/prompt_test.rb
|
88
90
|
- test/konamio/sequence/listener_test.rb
|
89
91
|
- test/konamio/sequence/requisition_test.rb
|