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



140
141
142
# File 'lib/tree_haver/contracts.rb', line 140

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



140
141
142
# File 'lib/tree_haver/contracts.rb', line 140

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



140
141
142
# File 'lib/tree_haver/contracts.rb', line 140

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



140
141
142
# File 'lib/tree_haver/contracts.rb', line 140

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



140
141
142
# File 'lib/tree_haver/contracts.rb', line 140

def start_byte
  @start_byte
end

#start_pointObject

Returns the value of attribute start_point

Returns:

  • (Object)

    the current value of start_point



140
141
142
# File 'lib/tree_haver/contracts.rb', line 140

def start_point
  @start_point
end

Instance Method Details

#byte_deltaObject



149
150
151
# File 'lib/tree_haver/contracts.rb', line 149

def byte_delta
  new_end_byte.to_i - old_end_byte.to_i
end

#new_rangeObject



145
146
147
# File 'lib/tree_haver/contracts.rb', line 145

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

#old_rangeObject



141
142
143
# File 'lib/tree_haver/contracts.rb', line 141

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

#to_hObject



153
154
155
156
157
158
159
160
161
162
# File 'lib/tree_haver/contracts.rb', line 153

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