Class: Dhaka::Precedence
- Inherits:
-
Object
- Object
- Dhaka::Precedence
- Includes:
- Comparable
- Defined in:
- lib/grammar/precedence.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#associativity ⇒ Object
readonly
Returns the value of attribute associativity.
-
#precedence_level ⇒ Object
readonly
Returns the value of attribute precedence_level.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(precedence_level, associativity) ⇒ Precedence
constructor
A new instance of Precedence.
- #to_s ⇒ Object
Constructor Details
#initialize(precedence_level, associativity) ⇒ Precedence
Returns a new instance of Precedence.
5 6 7 8 |
# File 'lib/grammar/precedence.rb', line 5 def initialize(precedence_level, associativity) @precedence_level = precedence_level @associativity = associativity end |
Instance Attribute Details
#associativity ⇒ Object (readonly)
Returns the value of attribute associativity.
4 5 6 |
# File 'lib/grammar/precedence.rb', line 4 def associativity @associativity end |
#precedence_level ⇒ Object (readonly)
Returns the value of attribute precedence_level.
4 5 6 |
# File 'lib/grammar/precedence.rb', line 4 def precedence_level @precedence_level end |
Instance Method Details
#<=>(other) ⇒ Object
10 11 12 |
# File 'lib/grammar/precedence.rb', line 10 def <=> other self.precedence_level <=> other.precedence_level end |
#to_s ⇒ Object
14 15 16 |
# File 'lib/grammar/precedence.rb', line 14 def to_s "Precedence: #{precedence_level} Associativity: #{associativity}" end |