diff options
| author | Kevin Newton <kddnewton@gmail.com> | 2023-08-22 12:21:35 -0400 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2023-08-25 21:10:15 +0000 |
| commit | 20cf9e3ae8ef05d7fc44e2fda8c5b8233e8eb03e (patch) | |
| tree | d0d60c47352405ff827db583af8898289ec2dd34 /lib | |
| parent | 55a8add304cdc88a466d396588f1f2d0022f7c45 (diff) | |
[ruby/yarp] Add a Location#to method for combining them
https://github.com/ruby/yarp/commit/1db2de98ac
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/yarp.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/yarp.rb b/lib/yarp.rb index f43aaa3d12..4c3cf268ce 100644 --- a/lib/yarp.rb +++ b/lib/yarp.rb @@ -112,6 +112,11 @@ module YARP other.end_offset == end_offset end + # Returns a new location that is the union of this location and the other. + def to(other) + Location.new(source, start_offset, other.end_offset - start_offset) + end + def self.null new(0, 0) end |
