77 lines
1.9 KiB
Clojure
77 lines
1.9 KiB
Clojure
(ns Module
|
|
"Elixir Module module — module introspection and manipulation.
|
|
|
|
In CljElixir: (Module/defines? MyModule :my-func 2), etc.")
|
|
|
|
(defn concat
|
|
"Concatenates atoms/strings into a module name.
|
|
(Module/concat [\"Elixir\" \"MyApp\" \"Router\"]) ;=> MyApp.Router
|
|
(Module/concat Elixir.MyApp :Router) ;=> MyApp.Router"
|
|
([list])
|
|
([left right]))
|
|
|
|
(defn split
|
|
"Splits a module name into parts.
|
|
(Module/split MyApp.Router) ;=> [\"MyApp\" \"Router\"]"
|
|
[module])
|
|
|
|
(defn defines?
|
|
"Returns true if `module` defines `function` with given `arity`.
|
|
(Module/defines? Enum :map 2) ;=> true
|
|
(Module/defines? Enum :map) ;=> true"
|
|
([module function-name])
|
|
([module function-name arity]))
|
|
|
|
(defn definitions-in
|
|
"Returns all functions/macros defined in `module`.
|
|
(Module/definitions-in Enum) ;=> [{:map 2} {:filter 2} ...]"
|
|
([module])
|
|
([module kind]))
|
|
|
|
(defn has-attribute?
|
|
"Returns true if `module` has `attribute`.
|
|
(Module/has-attribute? MyModule :behaviour) ;=> true"
|
|
[module attribute])
|
|
|
|
(defn get-attribute
|
|
"Gets a module attribute.
|
|
(Module/get-attribute MyModule :moduledoc)"
|
|
([module attribute])
|
|
([module attribute default]))
|
|
|
|
(defn put-attribute
|
|
"Sets a module attribute during compilation."
|
|
[module attribute value])
|
|
|
|
(defn delete-attribute
|
|
"Deletes a module attribute during compilation."
|
|
[module attribute])
|
|
|
|
(defn register-attribute
|
|
"Registers a module attribute during compilation."
|
|
[module attribute opts])
|
|
|
|
(defn spec-to-callback
|
|
"Converts a spec to a callback."
|
|
[module spec])
|
|
|
|
(defn open?
|
|
"Returns true if the module is open (being compiled)."
|
|
[module])
|
|
|
|
(defn overridable?
|
|
"Returns true if function is overridable in module."
|
|
[module function-arity])
|
|
|
|
(defn make-overridable
|
|
"Makes functions overridable."
|
|
[module function-arities])
|
|
|
|
(defn safe-concat
|
|
"Safely concatenates module atoms without creating new atoms."
|
|
[list])
|
|
|
|
(defn create
|
|
"Creates a module at runtime."
|
|
[module quoted opts])
|