Class: BattleOn::SendAttack
- Inherits:
-
Object
- Object
- BattleOn::SendAttack
- Defined in:
- lib/battle_on/send_attack.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#game_id ⇒ Object
readonly
Returns the value of attribute game_id.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(game_id, args) ⇒ SendAttack
constructor
A new instance of SendAttack.
Constructor Details
#initialize(game_id, args) ⇒ SendAttack
Returns a new instance of SendAttack.
12 13 14 15 16 |
# File 'lib/battle_on/send_attack.rb', line 12 def initialize(game_id, args) @game_id = game_id @x = args[:x] or raise ArgumentError, "Must pass 'x' attack" @y = args[:y] or raise ArgumentError, "Must pass 'y' attack" end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
6 7 8 |
# File 'lib/battle_on/send_attack.rb', line 6 def args @args end |
#game_id ⇒ Object (readonly)
Returns the value of attribute game_id.
6 7 8 |
# File 'lib/battle_on/send_attack.rb', line 6 def game_id @game_id end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
6 7 8 |
# File 'lib/battle_on/send_attack.rb', line 6 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
6 7 8 |
# File 'lib/battle_on/send_attack.rb', line 6 def y @y end |
Class Method Details
.execute(game_id, args) ⇒ Object
8 9 10 |
# File 'lib/battle_on/send_attack.rb', line 8 def self.execute(game_id, args) new(game_id, args).execute end |
Instance Method Details
#execute ⇒ Object
18 19 20 |
# File 'lib/battle_on/send_attack.rb', line 18 def execute JSON.parse attack end |