rb-snake 1.0.1 → 1.0.2
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/rb_snake/actions/change_direction.rb +2 -1
- data/lib/rb_snake/version.rb +1 -1
- data/lib/rb_snake/views/window.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f400a29e82c8cc7752cd7fbfad4950b71d900e96b68d4feaa24cf703c4f939ef
|
4
|
+
data.tar.gz: 7bdcc4b766b0c211a51856c2b205d9a2ebb5bbe5af0e0cfb27ed10aa224b2466
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86d582f6b85cff6a2eb60e130245837838d08227027e4ae095b22924518911c49597e15e6cec43c0c49c52dcabc17fd1e239083a1c28304b069f106863e447aa
|
7
|
+
data.tar.gz: 22979a42a381dadf15560ecd0afdb46847d1a6ff1234f036d6e2daf24bf50d14a6f1fcefa6962e6264c9c019b8592fe8a671704a96141a024b551684c99030c1
|
@@ -6,10 +6,11 @@ module RbSnake
|
|
6
6
|
module Actions
|
7
7
|
class ChangeDirection
|
8
8
|
class << self
|
9
|
-
def call(state, new_direction:)
|
9
|
+
def call(state, window, new_direction:)
|
10
10
|
return unless valid_direction?(state.current_direction, new_direction)
|
11
11
|
|
12
12
|
state.update_direction(new_direction)
|
13
|
+
MoveSnake.call(state, window)
|
13
14
|
end
|
14
15
|
|
15
16
|
private
|
data/lib/rb_snake/version.rb
CHANGED
@@ -82,13 +82,13 @@ module RbSnake
|
|
82
82
|
def handle_key_event(event, state)
|
83
83
|
case event.key
|
84
84
|
when "up"
|
85
|
-
Actions::ChangeDirection.call(state, new_direction: Models::Direction::UP)
|
85
|
+
Actions::ChangeDirection.call(state, self, new_direction: Models::Direction::UP)
|
86
86
|
when "down"
|
87
|
-
Actions::ChangeDirection.call(state, new_direction: Models::Direction::DOWN)
|
87
|
+
Actions::ChangeDirection.call(state, self, new_direction: Models::Direction::DOWN)
|
88
88
|
when "left"
|
89
|
-
Actions::ChangeDirection.call(state, new_direction: Models::Direction::LEFT)
|
89
|
+
Actions::ChangeDirection.call(state, self, new_direction: Models::Direction::LEFT)
|
90
90
|
when "right"
|
91
|
-
Actions::ChangeDirection.call(state, new_direction: Models::Direction::RIGHT)
|
91
|
+
Actions::ChangeDirection.call(state, self, new_direction: Models::Direction::RIGHT)
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rb-snake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Prada
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby2d
|