当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Elixir Module.put_attribute用法及代码示例


Elixir语言中 Module.put_attribute 相关用法介绍如下。

用法:

put_attribute(module, key, value)
@spec put_attribute(module(), atom(), term()) :: :ok

将带有 keyvalue 的模块属性放入给定的 module 中。

例子

defmodule MyModule do
  Module.put_attribute(__MODULE__, :custom_threshold_for_lib, 10)
end

相关用法


注:本文由纯净天空筛选整理自elixir-lang.org大神的英文原创作品 Module.put_attribute(module, key, value)。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。