module RailsConnector class ContentStateVisitor def initialize(start_content_state) @next_content_state, @visited = start_content_state, [] end def visit_next if content_state = @next_content_state @visited << content_state @next_content_state = content_state.from_content_state content_state end end def visited_except_current @visited[0..-2] end end end