Class: Fbtxt::Parser::Penalty
- Defined in:
- lib/fbtxt/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
88 89 90 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 88 def name @name end |
#note ⇒ Object
Returns the value of attribute note
88 89 90 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 88 def note @note end |
#score ⇒ Object
Returns the value of attribute score
88 89 90 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 88 def score @score end |
Instance Method Details
#as_json ⇒ Object
89 90 91 92 93 94 95 96 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 89 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
107 108 109 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 107 def pretty_print( q ) q.text( to_s ) end |
#to_s ⇒ Object
98 99 100 101 102 103 104 |
# File 'lib/fbtxt/parser/parse_tree-props.rb', line 98 def to_s buf = String.new buf << "#{score[0]}-#{score[1]} " if score buf << name buf << " (#{note})" if note buf end |