Class: RBI::Parser::HeredocLocationVisitor
- Inherits:
-
Prism::Visitor
- Object
- Prism::Visitor
- RBI::Parser::HeredocLocationVisitor
- Defined in:
- lib/rbi/parser.rb
Instance Method Summary collapse
-
#initialize(source, begin_offset, end_offset) ⇒ HeredocLocationVisitor
constructor
A new instance of HeredocLocationVisitor.
- #location ⇒ Object
- #visit_interpolated_string_node(node) ⇒ Object
- #visit_string_node(node) ⇒ Object
Constructor Details
#initialize(source, begin_offset, end_offset) ⇒ HeredocLocationVisitor
Returns a new instance of HeredocLocationVisitor.
1015 1016 1017 1018 1019 1020 1021 |
# File 'lib/rbi/parser.rb', line 1015 def initialize(source, begin_offset, end_offset) super() @source = source @begin_offset = begin_offset @end_offset = end_offset @offset_last_newline = false #: bool end |
Instance Method Details
#location ⇒ Object
1046 1047 1048 1049 1050 1051 1052 |
# File 'lib/rbi/parser.rb', line 1046 def location Prism::Location.new( @source, @begin_offset, @end_offset - @begin_offset - (@offset_last_newline ? 1 : 0), ) end |
#visit_interpolated_string_node(node) ⇒ Object
1036 1037 1038 1039 1040 1041 1042 1043 |
# File 'lib/rbi/parser.rb', line 1036 def visit_interpolated_string_node(node) return super unless node.heredoc? closing_loc = node.closing_loc return super unless closing_loc handle_string_node(node) end |
#visit_string_node(node) ⇒ Object
1025 1026 1027 1028 1029 1030 1031 1032 |
# File 'lib/rbi/parser.rb', line 1025 def visit_string_node(node) return unless node.heredoc? closing_loc = node.closing_loc return unless closing_loc handle_string_node(node) end |