zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

execution_source_files.ex (691B)


      1 defmodule Credo.Execution.ExecutionSourceFiles do
      2   @moduledoc false
      3 
      4   use GenServer
      5 
      6   alias Credo.Execution
      7 
      8   def start_server(exec) do
      9     {:ok, pid} = GenServer.start_link(__MODULE__, [])
     10 
     11     %Execution{exec | source_files_pid: pid}
     12   end
     13 
     14   def put(%Execution{source_files_pid: pid}, list) do
     15     GenServer.call(pid, {:put, list})
     16   end
     17 
     18   def get(%Execution{source_files_pid: pid}) do
     19     GenServer.call(pid, :get)
     20   end
     21 
     22   # callbacks
     23 
     24   def init(_) do
     25     {:ok, []}
     26   end
     27 
     28   def handle_call({:put, new_state}, _from, _current_state) do
     29     {:reply, new_state, new_state}
     30   end
     31 
     32   def handle_call(:get, _from, current_state) do
     33     {:reply, current_state, current_state}
     34   end
     35 end