Class: Canopus::Patch::Reload
- Inherits:
-
Object
- Object
- Canopus::Patch::Reload
- Defined in:
- lib/canopus/patch/reload.rb,
sig/canopus.rbs
Instance Attribute Summary collapse
-
#after ⇒ rope
readonly
Returns the value of attribute after.
-
#before ⇒ rope
readonly
Returns the value of attribute before.
Instance Method Summary collapse
- #edits ⇒ Array[Edit]
-
#initialize(before, after) ⇒ Reload
constructor
A new instance of Reload.
- #map_offset(offset, bias: :right) ⇒ Integer
Constructor Details
#initialize(before, after) ⇒ Reload
Returns a new instance of Reload.
5 |
# File 'lib/canopus/patch/reload.rb', line 5 def initialize(before, after) = (@before, @after = before, after) |
Instance Attribute Details
#after ⇒ rope (readonly)
Returns the value of attribute after.
4 5 6 |
# File 'lib/canopus/patch/reload.rb', line 4 def after @after end |
#before ⇒ rope (readonly)
Returns the value of attribute before.
4 5 6 |
# File 'lib/canopus/patch/reload.rb', line 4 def before @before end |
Instance Method Details
#map_offset(offset, bias: :right) ⇒ Integer
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/canopus/patch/reload.rb', line 7 def map_offset(offset, bias: :right) position = offset.clamp(0, after.bytesize) begin after.point_at(position) position rescue RangeError position -= 1 retry if position >= 0 raise end end |