Class: Fbtxt::Model::Penalty
- Inherits:
-
Object
- Object
- Fbtxt::Model::Penalty
- Defined in:
- lib/fbtxt/document/models/penalty.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#note ⇒ Object
readonly
Returns the value of attribute note.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(name:, score: nil, note: nil) ⇒ Penalty
constructor
A new instance of Penalty.
Constructor Details
#initialize(name:, score: nil, note: nil) ⇒ Penalty
Returns a new instance of Penalty.
14 15 16 17 18 |
# File 'lib/fbtxt/document/models/penalty.rb', line 14 def initialize( name:, score: nil, note: nil ) @name = name @score = score @note = note end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/fbtxt/document/models/penalty.rb', line 10 def name @name end |
#note ⇒ Object (readonly)
Returns the value of attribute note.
12 13 14 |
# File 'lib/fbtxt/document/models/penalty.rb', line 12 def note @note end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
11 12 13 |
# File 'lib/fbtxt/document/models/penalty.rb', line 11 def score @score end |
Instance Method Details
#as_json ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/fbtxt/document/models/penalty.rb', line 25 def as_json(*) h = { 'name' => name } h['score'] = score if score.is_a?(Array) && !score.empty? h['note'] = note if note h end |