Terms you'll encounter in the Speechwave codebase. Ruby equivalents noted where helpful.
:ok, :error, true. Ruby: same concept, same syntax.= operator doesn't assign, it matches the left side against the right. {:ok, result} = {:ok, 42} binds result to 42. If sides don't match, it raises MatchError. Ruby: no equivalent, closest is destructuring in JS.^)^x = 5 asserts that x is 5.|>)data |> transform() |> save(). Ruby: like method chaining, but for free functions.when condition on a function head that restricts when that clause matches: def foo(x) when is_integer(x).~ prefix for literal syntax: ~r/regex/, ~w(word list), ~T[12:00:00].defstruct. %Talk{slug: "demo"}. Ruby: like Struct.new(:slug) but enforced at compile time.defmodule. No instances, no state. Ruby: like a module with only class methods, no self state.def / defpuse__using__/1 macro. use GenServer gives you GenServer callbacks. Ruby: like include but can rewrite the including module.importimport Ecto.Query.aliasalias Speechwave.Talks.Talk lets you write Talk instead of the full path.@ (module attribute)@moduledoc, @impl true. Ruby: no direct equivalent, partly like class-level constants.socket.assignsassign(socket, key: value) stores data; templates access it as @key. Ruby/Rails: like instance variables in a controller, but immutable, you return a new socket.mount/3{:ok, socket}.handle_event/3{:noreply, socket}.handle_info/2{:noreply, socket}.Speechwave.Talks, Speechwave.Accounts. Phoenix convention for organizing business logic. Ruby/Rails: like a Service Object or the Model layer, but explicitly a module of functions.Repo.insert/update. Ruby/Rails: like ActiveRecord validations, but the validation result is a separate data structure from the record.%Scope{user: user} wraps the authenticated user so context functions always filter by owner.pipeline :browser do ... end.application.ex.RateLimiter and AuthThrottle are GenServers.