rb-snake 1.0.1 → 1.0.2

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
  SHA256:
3
- metadata.gz: 529079a6646e1e0bfc700fa65d4a8fe80d01f85c5e3871790797fe628d5b5a07
4
- data.tar.gz: 5eb2921b933580848c2c5a7d7a51127ea1b02d64e36b998704477975978261ff
3
+ metadata.gz: f400a29e82c8cc7752cd7fbfad4950b71d900e96b68d4feaa24cf703c4f939ef
4
+ data.tar.gz: 7bdcc4b766b0c211a51856c2b205d9a2ebb5bbe5af0e0cfb27ed10aa224b2466
5
5
  SHA512:
6
- metadata.gz: 57b85516859d4bf5ba21ad80ced31eb8d7acaef84fb09b3e15a15629b1e7f4dfc155c6c783462608e5cdf8eb2cba944da9d75c4aab35c7242c80e132e5c78f88
7
- data.tar.gz: 4a1262d36a8146d3fdf3937ffd0ae8bca0356eefe2e59bbd98d11ba8f5ba251d5e1774a80f2965c3e5ccee0a997514cfd6f534aa33c59fde8035c7d714bbbf75
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RbSnake
4
- VERSION = '1.0.1'
4
+ VERSION = '1.0.2'
5
5
  end
@@ -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.1
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-04-23 00:00:00.000000000 Z
11
+ date: 2023-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby2d