Class: Yoda::AST::CommentBlock::TagTextNamePart

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RangeCalculation

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

Constructor Details

#initialize(parent:, tokens:) ⇒ TagTextNamePart

Returns a new instance of TagTextNamePart.

Parameters:

  • parent (BasePart)
  • tokens (Array<Parslet::Slice>)


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

def initialize(parent:, tokens:)
  @parent = parent
  @tokens = tokens
end

Instance Attribute Details

#parentBasePart (readonly)

Returns:



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

def parent
  @parent
end

#tokensArray<Parslet::Slice> (readonly)

Returns:

  • (Array<Parslet::Slice>)


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

def tokens
  @tokens
end

Instance Method Details

#begin_indexInteger

Returns:

  • (Integer)


24
25
26
# File 'lib/yoda/ast/comment_block/tag_text_name_part.rb', line 24

def begin_index
  tokens.first.offset
end

#comment_blockCommentBlock

Returns:



19
20
21
# File 'lib/yoda/ast/comment_block/tag_text_name_part.rb', line 19

def comment_block
  parent.comment_block
end

#end_indexInteger

Returns:

  • (Integer)


29
30
31
# File 'lib/yoda/ast/comment_block/tag_text_name_part.rb', line 29

def end_index
  tokens.last.offset + tokens.last.length
end