Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Ruby::Prism::Location#join
join(other)
lib/ruby/prism/parse_result.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/ruby/prism/parse_result.rb, line 679
def join(other)
raise "Incompatible sources" if source != other.source
raise "Incompatible locations" if start_offset > other.start_offset
Location.new(source, start_offset, other.end_offset - start_offset)
end
Returns a new location that stretches from this location to the given other location. Raises an error if this location is not before the other location or if they don’t share the same source.