Class: Fbtxt::Model::EventCard
- Inherits:
-
Object
- Object
- Fbtxt::Model::EventCard
- Defined in:
- lib/fbtxt/document/models/event.rb
Overview
e.g. 'Y', Player, 44 'YR', Player, 45+2
Instance Attribute Summary collapse
-
#minute ⇒ Object
readonly
Returns the value of attribute minute.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
use EventBooking - why? why not?.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(type:, name:, minute: nil) ⇒ EventCard
constructor
A new instance of EventCard.
Constructor Details
#initialize(type:, name:, minute: nil) ⇒ EventCard
Returns a new instance of EventCard.
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fbtxt/document/models/event.rb', line 16 def initialize( type:, name:, minute: nil ) @type = type @name = name ## note - auto-convert to our own Minute format @minute = if minute.is_a?( RaccMatchParser::Minute ) Minute.new( m: minute.m, offset: minute.offset, secs: minute.secs ) else minute end end |
Instance Attribute Details
#minute ⇒ Object (readonly)
Returns the value of attribute minute.
14 15 16 |
# File 'lib/fbtxt/document/models/event.rb', line 14 def minute @minute end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/fbtxt/document/models/event.rb', line 13 def name @name end |
#type ⇒ Object (readonly)
use EventBooking - why? why not?
12 13 14 |
# File 'lib/fbtxt/document/models/event.rb', line 12 def type @type end |
Instance Method Details
#as_json ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/fbtxt/document/models/event.rb', line 31 def as_json(*) h = { 'type' => type, 'name' => name } h['minute'] = minute.to_s if minute h end |