This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AddsUserToList | |
attr_reader :notifies_user_klass, :user_klass | |
def initialize(user_klass = User, notifies_user_klass = NotifiesUser) | |
@user_klass = user_klass | |
@notifies_user_klass = notifies_user_klass | |
end | |
def add(params) | |
user_klass.find_by_username!(params.fetch(:username).tap do |user| | |
notifies_user_klass.(user, params.fetch(:mailing_list_name)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Exercies 1 | |
;; Write a function called ends_in_3(num) that returns true if the final digit of num is 3, and false otherwise. | |
(fn ends_in_3 [num] | |
(let [num-str (.. "" num)] | |
(let [tbl (icollect [s (string.gmatch num-str "%d")] s)] | |
(if (= "3" (. tbl (length tbl))) | |
true | |
false)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
===> Load global config file /home/hamza/.config/rebar3/rebar.config | |
===> Evaluating config script "/home/hamza/.cache/rebar3/plugins/lfe/rebar.config.script" | |
===> 25.2.3 satisfies the requirement for minimum OTP version 18 | |
===> Evaluating config script "/home/hamza/.cache/rebar3/plugins/hex_core/rebar.config.script" | |
===> 25.2.3 satisfies the requirement for minimum OTP version 19.3 | |
===> Setting paths to [deps] | |
===> Compile (apps) | |
===> Setting paths to [plugins] | |
===> Setting paths to [deps] | |
===> Setting paths to [plugins] |