Class: Player::Card

Inherits:
Object show all
Defined in:
lib/fifadat/models/player.rb

Overview

keep Card nested here - why? why not?

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(player:, type:, minute:) ⇒ Card

Returns a new instance of Card.



26
27
28
29
30
# File 'lib/fifadat/models/player.rb', line 26

def initialize( player:, type:, minute: )
   @player = player
   @type   = type
   @minute = minute
end

Instance Attribute Details

#minute ⇒ Object (readonly)

Returns the value of attribute minute.



25
26
27
# File 'lib/fifadat/models/player.rb', line 25

def minute
  @minute
end

#player ⇒ Object (readonly)

Returns the value of attribute player.



25
26
27
# File 'lib/fifadat/models/player.rb', line 25

def player
  @player
end

#type ⇒ Object (readonly)

Returns the value of attribute type.



25
26
27
# File 'lib/fifadat/models/player.rb', line 25

def type
  @type
end

Instance Method Details

#as_json ⇒ Object

only print name and minute for now - why? why not?



33
34
35
36
37
38
39
# File 'lib/fifadat/models/player.rb', line 33

def as_json(*)
   h = {
         'name'     => player.name,
         'minute'   => minute
       }
   h
end