Class: Yoda::AST::CommentBlock::TextPart

Inherits:
BasePart
  • Object
show all
Defined in:
lib/yoda/ast/comment_block/text_part.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RangeCalculation

#begin_location, #end_location, #include?, #range, #text

Constructor Details

#initialize(comment_block:, token:) ⇒ TextPart

Returns a new instance of TextPart.

Parameters:



13
14
15
16
# File 'lib/yoda/ast/comment_block/text_part.rb', line 13

def initialize(comment_block:, token:)
  @comment_block = comment_block
  @token = token
end

Instance Attribute Details

#comment_blockCommentBlock (readonly)

Returns:



6
7
8
# File 'lib/yoda/ast/comment_block/text_part.rb', line 6

def comment_block
  @comment_block
end

#tokenParsing::CommentTokenizer::Text (readonly)



9
10
11
# File 'lib/yoda/ast/comment_block/text_part.rb', line 9

def token
  @token
end

Instance Method Details

#begin_indexObject



18
19
20
# File 'lib/yoda/ast/comment_block/text_part.rb', line 18

def begin_index
  token.content.offset
end

#end_indexObject



22
23
24
# File 'lib/yoda/ast/comment_block/text_part.rb', line 22

def end_index
  token.content.offset + token.content.length
end