Class: Nodewrap::ByteDecoder::Expression
Direct Known Subclasses
Array, Assignment, ConcatArray, ConcatStrings, Constant, Defined, Hash, Infix, Literal, Prefix, Self, Send, Throw, ToRegexp, Variable
Defined Under Namespace
Classes: Array, Assignment, ConcatArray, ConcatStrings, Constant, ConstantAssignment, Defined, Hash, Infix, Literal, Prefix, Self, Send, Throw, ToRegexp, Variable
Instance Attribute Summary collapse
-
#pc ⇒ Object
readonly
Returns the value of attribute pc.
Instance Method Summary collapse
- #<=>(rhs) ⇒ Object
- #fmt(arg) ⇒ Object
-
#initialize(pc) ⇒ Expression
constructor
A new instance of Expression.
Constructor Details
#initialize(pc) ⇒ Expression
Returns a new instance of Expression.
53 54 55 |
# File 'lib/bytedecoder.rb', line 53 def initialize(pc) @pc = pc end |
Instance Attribute Details
#pc ⇒ Object (readonly)
Returns the value of attribute pc.
51 52 53 |
# File 'lib/bytedecoder.rb', line 51 def pc @pc end |
Instance Method Details
#<=>(rhs) ⇒ Object
57 58 59 |
# File 'lib/bytedecoder.rb', line 57 def <=>(rhs) return @pc <=> rhs.pc end |
#fmt(arg) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/bytedecoder.rb', line 61 def fmt(arg) if arg.respond_to?(:precedence) p = arg.precedence else p = 0 end if p >= self.precedence then return "(#{arg})" else return arg end end |