Module: Yoda::AST::CommentBlock::RangeCalculation Abstract
- Included in:
- BasePart
- Defined in:
- lib/yoda/ast/comment_block/range_calculation.rb
Overview
This module is abstract.
Instance Method Summary collapse
- #begin_index ⇒ Integer abstract
- #begin_location ⇒ Parsing::Location?
- #comment_block ⇒ CommentBlock abstract
- #end_index ⇒ Integer abstract
- #end_location ⇒ Parsing::Location?
- #include?(location) ⇒ Boolean
- #range ⇒ Parsing::Range?
- #text ⇒ String?
Instance Method Details
#begin_index ⇒ Integer
This method is abstract.
12 13 14 |
# File 'lib/yoda/ast/comment_block/range_calculation.rb', line 12 def begin_index fail NotImplementedError end |
#begin_location ⇒ Parsing::Location?
23 24 25 |
# File 'lib/yoda/ast/comment_block/range_calculation.rb', line 23 def begin_location @begin_location ||= comment_block.location_from_index(begin_index) end |
#comment_block ⇒ CommentBlock
This method is abstract.
|
# File 'lib/yoda/ast/comment_block/range_calculation.rb', line 6
|
#end_index ⇒ Integer
This method is abstract.
18 19 20 |
# File 'lib/yoda/ast/comment_block/range_calculation.rb', line 18 def end_index fail NotImplementedError end |
#end_location ⇒ Parsing::Location?
28 29 30 |
# File 'lib/yoda/ast/comment_block/range_calculation.rb', line 28 def end_location @end_location ||= comment_block.location_from_index(end_index) end |
#include?(location) ⇒ Boolean
52 53 54 |
# File 'lib/yoda/ast/comment_block/range_calculation.rb', line 52 def include?(location) range&.include?(location) end |
#range ⇒ Parsing::Range?
33 34 35 36 37 38 39 |
# File 'lib/yoda/ast/comment_block/range_calculation.rb', line 33 def range if begin_location && end_location Parsing::Range.new(begin_location, end_location) else nil end end |
#text ⇒ String?
42 43 44 45 46 47 48 |
# File 'lib/yoda/ast/comment_block/range_calculation.rb', line 42 def text if begin_location && end_location comment_block.text.slice(Range.new(begin_index, end_index)) else nil end end |