Module: BEL::Extension

Defined in:
lib/bel/extension.rb,
lib/bel/extension_format.rb

Overview

The Extension module defines specific areas of customization within the bel gem:

  • Document formats: see Format

Defined Under Namespace

Modules: Format Classes: ExtensionRegistrationError

Class Method Summary collapse

Class Method Details

.load_extension(*extensions) ⇒ Object

Loads BEL extensions from the $LOAD_PATH under the path bel/extensions/{extension}. These extensions are merely ruby scripts meant to extend functionality within the bel gem.

For example, let’s say we created the foo.rb file containing a Foo extension. We must do the following to load it:

  • Locate foo.rb at bel/extensions/foo.rb anywhere on the $LOAD_PATH.

  • Instantiate and register our extension.

  • Call BEL.extension :foo to load the extension.

Parameters:

  • extensions (Array<#to_s>)

    the extensions to load



21
22
23
24
25
# File 'lib/bel/extension.rb', line 21

def self.load_extension(*extensions)
  extensions.each do |ext|
    Kernel.require "bel/extensions/#{ext}"
  end
end