Class: Fbtxt::Model::Player

Inherits:
Object
  • Object
show all
Defined in:
lib/fbtxt/document/models/player.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, captain: false) ⇒ Player

Returns a new instance of Player.



13
14
15
16
# File 'lib/fbtxt/document/models/player.rb', line 13

def initialize( name:, captain: false )
    @name    = name
    @captain = captain
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/fbtxt/document/models/player.rb', line 8

def name
  @name
end

Instance Method Details

#as_jsonObject



22
23
24
25
26
27
# File 'lib/fbtxt/document/models/player.rb', line 22

def as_json(*)
    h = { 'name' => name }
    h['captain'] = true    if captain?

    h
end

#captain?Boolean

Returns:

  • (Boolean)


18
# File 'lib/fbtxt/document/models/player.rb', line 18

def captain?() @captain; end