Class: SportDb::Parser::Penalty
- Defined in:
- lib/sportdb/parser/parse_tree-props.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#note ⇒ Object
Returns the value of attribute note.
-
#score ⇒ Object
Returns the value of attribute score.
Instance Method Summary collapse
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
64 65 66 |
# File 'lib/sportdb/parser/parse_tree-props.rb', line 64 def name @name end |
#note ⇒ Object
Returns the value of attribute note
64 65 66 |
# File 'lib/sportdb/parser/parse_tree-props.rb', line 64 def note @note end |
#score ⇒ Object
Returns the value of attribute score
64 65 66 |
# File 'lib/sportdb/parser/parse_tree-props.rb', line 64 def score @score end |
Instance Method Details
#as_json ⇒ Object
65 66 67 68 69 70 71 72 |
# File 'lib/sportdb/parser/parse_tree-props.rb', line 65 def as_json(*) h = { 'name' => name } h['score'] = "#{score[0]}-#{score[1]}" if score h['note'] = "(#{note})" if note ## ['<Penalty>', h] h # note - return "inline" json object end |
#pretty_print(q) ⇒ Object
83 84 85 |
# File 'lib/sportdb/parser/parse_tree-props.rb', line 83 def pretty_print( q ) q.text( to_s ) end |
#to_s ⇒ Object
74 75 76 77 78 79 80 |
# File 'lib/sportdb/parser/parse_tree-props.rb', line 74 def to_s buf = String.new buf << "#{score[0]}-#{score[1]} " if score buf << name buf << " (#{note})" if note buf end |