rdodson41/ruby-lox

View on GitHub
lib/lox/scanner.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

module Lox
  class Scanner
    attr_reader :input

    def initialize(input)
      @input = input
    end

    def each_char
      return enum_for(:each_char) unless block_given?

      input.each_line do |line|
        line.each_char do |character|
          yield(character)
        end
      end
    end
  end
end