Hologram.Compiler.Helpers (hologram v0.1.0)

Link to this section Summary

Functions

Returns the corresponding class name which can be used in JavaScript.

Returns the corresponding Elixir module.

Returns the corresponding module name (without the "Elixir" segment at the beginning).

Returns the corresponding module segments (without the "Elixir" segment at the beginning).

Returns true if the first module has a "use" directive for the second module.

Link to this section Functions

Link to this function

aggregate_bindings(params)

Link to this function

aggregate_function_def_variants(function_defs)

Link to this function

class_name(module)

Specs

class_name(module()) :: String.t()

Returns the corresponding class name which can be used in JavaScript.

Examples

iex> Helpers.class_name(Abc.Bcd)
"Elixir_Abc_Bcd"
Link to this function

fetch_block_body(ast)

Link to this function

get_components(module_defs_map)

Specs

get_components(Hologram.Typespecs.module_definitions_map()) :: [
  %Hologram.Compiler.IR.ModuleDefinition{
    aliases: term(),
    attributes: term(),
    component?: term(),
    functions: term(),
    imports: term(),
    layout?: term(),
    macros: term(),
    module: term(),
    page?: term(),
    requires: term(),
    templatable?: term(),
    uses: term()
  }
]
Link to this function

get_pages(module_defs_map)

Specs

get_pages(Hologram.Typespecs.module_definitions_map()) :: [
  %Hologram.Compiler.IR.ModuleDefinition{
    aliases: term(),
    attributes: term(),
    component?: term(),
    functions: term(),
    imports: term(),
    layout?: term(),
    macros: term(),
    module: term(),
    page?: term(),
    requires: term(),
    templatable?: term(),
    uses: term()
  }
]
Link to this function

module(module_segs)

Specs

Returns the corresponding Elixir module.

Examples

iex> Helpers.module([:Abc, :Bcd])
Elixir.Abc.Bcd
Link to this function

module_name(module)

Specs

module_name(module()) :: String.t()

Returns the corresponding module name (without the "Elixir" segment at the beginning).

Examples

iex> Helpers.module_name(Abc.Bcd)
"Abc.Bcd"
Link to this function

module_name_segments(module_name)

Specs

module_name_segments(module() | String.T) ::
  Hologram.Typespecs.module_name_segments()

Returns the corresponding module segments (without the "Elixir" segment at the beginning).

Examples

iex> Helpers.module_name_segments(Abc.Bcd)
[:Abc, :Bcd]
Link to this function

transform_params(params, context)

Link to this function

uses_module?(user_module_def, used_module)

Specs

uses_module?(
  %Hologram.Compiler.IR.ModuleDefinition{
    aliases: term(),
    attributes: term(),
    component?: term(),
    functions: term(),
    imports: term(),
    layout?: term(),
    macros: term(),
    module: term(),
    page?: term(),
    requires: term(),
    templatable?: term(),
    uses: term()
  },
  module()
) :: boolean()

Returns true if the first module has a "use" directive for the second module.

Examples

iex> user_module = %ModuleDefinition{module: Hologram.Compiler.Parser, ...}
iex> Helpers.uses_module?(user_module, Hologram.Commons.Parser)
true