Class: TreeHaver::ByteEditSpan

Inherits:
Struct
  • Object
show all
Defined in:
lib/tree_haver/contracts.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#new_end_byteObject

Returns the value of attribute new_end_byte

Returns:

  • (Object)

    the current value of new_end_byte



742
743
744
# File 'lib/tree_haver/contracts.rb', line 742

def new_end_byte
  @new_end_byte
end

#new_end_pointObject

Returns the value of attribute new_end_point

Returns:

  • (Object)

    the current value of new_end_point



742
743
744
# File 'lib/tree_haver/contracts.rb', line 742

def new_end_point
  @new_end_point
end

#old_end_byteObject

Returns the value of attribute old_end_byte

Returns:

  • (Object)

    the current value of old_end_byte



742
743
744
# File 'lib/tree_haver/contracts.rb', line 742

def old_end_byte
  @old_end_byte
end

#old_end_pointObject

Returns the value of attribute old_end_point

Returns:

  • (Object)

    the current value of old_end_point



742
743
744
# File 'lib/tree_haver/contracts.rb', line 742

def old_end_point
  @old_end_point
end

#start_byteObject

Returns the value of attribute start_byte

Returns:

  • (Object)

    the current value of start_byte



742
743
744
# File 'lib/tree_haver/contracts.rb', line 742

def start_byte
  @start_byte
end

#start_pointObject

Returns the value of attribute start_point

Returns:

  • (Object)

    the current value of start_point



742
743
744
# File 'lib/tree_haver/contracts.rb', line 742

def start_point
  @start_point
end

Instance Method Details

#byte_deltaObject



752
753
754
# File 'lib/tree_haver/contracts.rb', line 752

def byte_delta
  new_end_byte.to_i - old_end_byte.to_i
end

#new_rangeObject



748
749
750
# File 'lib/tree_haver/contracts.rb', line 748

def new_range
  ByteRange.new(start_byte: start_byte, end_byte: new_end_byte)
end

#old_rangeObject



744
745
746
# File 'lib/tree_haver/contracts.rb', line 744

def old_range
  ByteRange.new(start_byte: start_byte, end_byte: old_end_byte)
end

#to_hObject



756
757
758
759
760
761
762
763
764
765
# File 'lib/tree_haver/contracts.rb', line 756

def to_h
  {
    start_byte: start_byte,
    old_end_byte: old_end_byte,
    new_end_byte: new_end_byte,
    start_point: start_point.to_h,
    old_end_point: old_end_point.to_h,
    new_end_point: new_end_point.to_h
  }
end