Class: L43MyRuby::ExtractLines::State

Inherits:
Object
  • Object
show all
Defined in:
lib/l43_my_ruby/extract_lines/state.rb

Class Method Summary collapse

Class Method Details

.run(state) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/l43_my_ruby/extract_lines/state.rb', line 7

def run(state)
  loop do
    case state.input
    in []
      return state
    in [line, *rest]
      state = _new_state(line:, state: state.with(input: rest))
    end
  end
end