Class: Action

Inherits:
Object
  • Object
show all
Defined in:
lib/Hashiparmentier/Core/Action.rb

Overview

Auteur

Brabant Mano

Version

0.1

Date

09/04/2020

Cette classe représente les actions réalisées par le joueur (placer, retirer des ponts)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ile1, ile2, methode) ⇒ Action

:nodoc:



33
34
35
36
37
38
39
# File 'lib/Hashiparmentier/Core/Action.rb', line 33

def initialize(ile1, ile2, methode)

  @ile1 = ile1
  @ile2 = ile2
  @methode = methode

end

Instance Attribute Details

#ile1Object (readonly)

Returns the value of attribute ile1.



12
13
14
# File 'lib/Hashiparmentier/Core/Action.rb', line 12

def ile1
  @ile1
end

#ile2Object (readonly)

Returns the value of attribute ile2.



15
16
17
# File 'lib/Hashiparmentier/Core/Action.rb', line 15

def ile2
  @ile2
end

#methodeObject (readonly)

Returns the value of attribute methode.



18
19
20
# File 'lib/Hashiparmentier/Core/Action.rb', line 18

def methode
  @methode
end

Class Method Details

.creer(ile1, ile2, methode) ⇒ Object

Ce constructeur permet de creer une nouvelle action

param
  • ile1 La premiere ile

  • ile2 La deuxieme ile

  • methode La methode utilisé (createPont ou supprimePont)



28
29
30
# File 'lib/Hashiparmentier/Core/Action.rb', line 28

def Action.creer(ile1, ile2, methode)
  new(ile1, ile2, methode)
end

Instance Method Details

#to_sObject

Cette méthode permet d’afficher l’action



44
45
46
# File 'lib/Hashiparmentier/Core/Action.rb', line 44

def to_s
  @ile1.to_s() + ":" + @ile2.to_s() + ":" + @methode.to_s()
end