Skip to content

Instantly share code, notes, and snippets.

input = "SOME INPUT FORM WHATEVER"
Notifier.build(input).call
class Notifier
class << self
def build(input)
new(
input,
Parser.new,
Gateway.new
)
end
end
parser = Parser.new
gateway = Gateway.new
input = "SOME INPUT FORM WHATEVER"
Notifier.new(input, parser, gateway).call
class Notifier
def initialize(input, parser, gateway)
@input = input
@parser = parser
@gateway = gateway
end
def call
parsed_input = parser.parse(input)
gateway.call(parsed_input)
class Notifier
def initialize(input, parser, gateway)
@input = input
@parser = parser
@gateway = gateway
end
def call
parsed_input = parser.parse(input)
gateway.call(parsed_input)
class SendDayResults
ELIGIBLE_ROLES = {regular: 1, vip: 2}
attr_reader :user
def initialize(user)
@user = user
end
def call
<%= current_user(@conn) %>
def current_user(conn) do
conn.assigns[:current_user]
end
plug ElixirStream.Plugs.CheckAuthentication
defmodule ElixirStream.Plugs.CheckAuthentication do
import Plug.Conn
import Plug.Session
def init(options) do
options
end
def call(conn, _) do
user_id = get_session(conn, :user_id)