Module: Iode::Core

Extended by:
Core
Included in:
Core
Defined in:
lib/iode/core.rb,
lib/iode/core/math.rb,
lib/iode/core/lists.rb,
lib/iode/core/output.rb,
lib/iode/core/strings.rb,
lib/iode/core/comparisons.rb

Overview

Iode Core language definitions.

This is simply a module that exposes all its instance methods as functions.

The actual functions are mixed in by other modules.

Defined Under Namespace

Modules: Comparisons, Lists, Math, Output, Strings

Class Method Summary collapse

Class Method Details

.definitionsHash

Get a singleton instance of all the core definitions.

Returns:

  • (Hash)

    core functions and variables



39
40
41
42
43
44
45
46
# File 'lib/iode/core.rb', line 39

def definitions
  @definitions ||=
    Hash[
      names.zip(
        names.map(&method(:instance_method)).map{|m| m.bind(self)}
      )
    ]
end

.register(base) ⇒ Object

Register a new library of functions into the global definitions.

Parameters:

  • base (Module)

    the module to register



31
32
33
# File 'lib/iode/core.rb', line 31

def register(base)
  include(base).tap{@definitions = nil}
end