Class: RubyArena::CommandParser
- Inherits:
-
Object
- Object
- RubyArena::CommandParser
- Defined in:
- lib/ruby_arena/command_parser.rb
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
Instance Method Summary collapse
- #accelerate ⇒ Object
- #decelerate ⇒ Object
- #fire ⇒ Object
-
#initialize ⇒ CommandParser
constructor
A new instance of CommandParser.
- #radar_view_angle(angle) ⇒ Object
- #reset_actions ⇒ Object
- #turn(angle) ⇒ Object
- #turn_gun(angle) ⇒ Object
- #turn_radar(angle) ⇒ Object
Constructor Details
#initialize ⇒ CommandParser
Returns a new instance of CommandParser.
5 6 7 |
# File 'lib/ruby_arena/command_parser.rb', line 5 def initialize reset_actions end |
Instance Attribute Details
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
3 4 5 |
# File 'lib/ruby_arena/command_parser.rb', line 3 def actions @actions end |
Instance Method Details
#accelerate ⇒ Object
21 22 23 |
# File 'lib/ruby_arena/command_parser.rb', line 21 def accelerate @actions[:accelerate] = true end |
#decelerate ⇒ Object
25 26 27 |
# File 'lib/ruby_arena/command_parser.rb', line 25 def decelerate @actions[:decelerate] = true end |
#fire ⇒ Object
29 30 31 |
# File 'lib/ruby_arena/command_parser.rb', line 29 def fire @actions[:fire] = true end |
#radar_view_angle(angle) ⇒ Object
33 34 35 |
# File 'lib/ruby_arena/command_parser.rb', line 33 def radar_view_angle(angle) @actions[:radar_view_angle] = angle end |
#reset_actions ⇒ Object
37 38 39 |
# File 'lib/ruby_arena/command_parser.rb', line 37 def reset_actions @actions = {} end |
#turn(angle) ⇒ Object
9 10 11 |
# File 'lib/ruby_arena/command_parser.rb', line 9 def turn(angle) @actions[:turn] = angle end |
#turn_gun(angle) ⇒ Object
13 14 15 |
# File 'lib/ruby_arena/command_parser.rb', line 13 def turn_gun(angle) @actions[:turn_gun] = angle end |
#turn_radar(angle) ⇒ Object
17 18 19 |
# File 'lib/ruby_arena/command_parser.rb', line 17 def turn_radar(angle) @actions[:turn_radar] = angle end |