Class: Fbtxt::Model::Player
- Inherits:
-
Object
- Object
- Fbtxt::Model::Player
- Defined in:
- lib/fbtxt/document/models/player.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #as_json ⇒ Object
- #captain? ⇒ Boolean
-
#initialize(name:, captain: false) ⇒ Player
constructor
A new instance of Player.
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
#name ⇒ Object (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_json ⇒ Object
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
18 |
# File 'lib/fbtxt/document/models/player.rb', line 18 def captain?() @captain; end |