ddfreyne/d-parse

View on GitHub
lib/d-parse/string_slice.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

module DParse
  class StringSlice
    attr_reader :string, :from, :to

    def initialize(string:, from:, to:)
      @string = string
      @from = from
      @to = to
    end

    def resolve
      @string[@from.index...@to.index]
    end

    def inspect
      "StringSlice(#{@from}..#{@to})"
    end
  end
end