You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: actions.rb
    path of file: ./repos/pakyow/frameworks/reflection/lib/pakyow/reflection/builders
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

require_relative "base"
require_relative "helpers/controller"

module Pakyow
  module Reflection
    module Builders
      # @api private
      class Actions < Base
        include Helpers::Controller

        def build(actions)
          actions.each do |action|
            define_action(action)
          end
        end

        private

   
    
        def define_action(action)
          if action.parents.any?
            parents = action.parents.dup

            current_resource = ensure_controller_has_helpers(
              find_or_define_resource_for_scope_at_path(parents.shift, action.view_path)
            )

            parents.each do |parent|
              current_resource = ensure_controller_has_helpers(
                find_or_define_resource_for_scope_in_resource(parent, current_resource)
              )
            end

            resource = find_or_define_resource_for_scope_in_resource(action.scope, current_resource)
          else
            resource = find_or_define_resource_for_scope_at_path(action.scope, action.view_path)
          end