class Spoom::Source::Replace

def apply(bytes)

: (Array[Integer]) -> void
@override
def apply(bytes)
  raise PositionError,
    "Position is out of bounds" if from < 0 || to < 0 || from > bytes.size || to > bytes.size || from > to
  bytes[from..to] = *text.bytes
end

def initialize(from, to, text)

: (Integer, Integer, String) -> void
def initialize(from, to, text)
  super()
  @from = from
  @to = to
  @text = text
end

def range

: -> [Integer, Integer]
@override
def range
  [from, to]
end

def to_s

: -> String
@override
def to_s
  "Replace #{from}-#{to} with `#{text}`"
end