Class: Decode::Syntax::Match
- Inherits:
-
Object
- Object
- Decode::Syntax::Match
- Defined in:
- lib/decode/syntax/match.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#range ⇒ Object
readonly
Returns the value of attribute range.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #apply(output, rewriter) ⇒ Object
-
#initialize(range) ⇒ Match
constructor
A new instance of Match.
- #offset ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(range) ⇒ Match
Returns a new instance of Match.
9 10 11 |
# File 'lib/decode/syntax/match.rb', line 9 def initialize(range) @range = range end |
Instance Attribute Details
#range ⇒ Object (readonly)
Returns the value of attribute range.
13 14 15 |
# File 'lib/decode/syntax/match.rb', line 13 def range @range end |
Instance Method Details
#<=>(other) ⇒ Object
19 20 21 |
# File 'lib/decode/syntax/match.rb', line 19 def <=> other @range.min <=> other.range.min end |
#apply(output, rewriter) ⇒ Object
15 16 17 |
# File 'lib/decode/syntax/match.rb', line 15 def apply(source) return source[range] end |
#offset ⇒ Object
23 24 25 |
# File 'lib/decode/syntax/match.rb', line 23 def offset @range.min end |
#size ⇒ Object
27 28 29 |
# File 'lib/decode/syntax/match.rb', line 27 def size @range.size end |