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.
24 25 26 |
# File 'lib/decode/syntax/match.rb', line 24 def initialize(range) @range = range end |
Instance Attribute Details
#range ⇒ Object (readonly)
Returns the value of attribute range.
28 29 30 |
# File 'lib/decode/syntax/match.rb', line 28 def range @range end |
Instance Method Details
#<=>(other) ⇒ Object
34 35 36 |
# File 'lib/decode/syntax/match.rb', line 34 def <=> other @range.min <=> other.range.min end |
#apply(output, rewriter) ⇒ Object
30 31 32 |
# File 'lib/decode/syntax/match.rb', line 30 def apply(source) return source[range] end |
#offset ⇒ Object
38 39 40 |
# File 'lib/decode/syntax/match.rb', line 38 def offset @range.min end |
#size ⇒ Object
42 43 44 |
# File 'lib/decode/syntax/match.rb', line 42 def size @range.size end |