Module: SGC::Helper::IEnum Abstract

Included in:
CU::API::Enum, Cuda::API::Enum
Defined in:
lib/helpers/interface/ienum.rb

Overview

This module is abstract.

An Enum interface.

An enum maps a symbol to a value, and a value to a symbol.

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Symbol, Object

Returns The symbol or value that the key maps to.

  • If the key is a symbol, return the corresponding value.

  • If the key is a value, return the corresponding symbol.

  • Return nil if the key is invalid.

Parameters:

  • key (Symbol, Object)

    A symbol or value to use as a key to map.

Returns:

  • (Symbol, Object)

    The symbol or value that the key maps to.

    • If the key is a symbol, return the corresponding value.

    • If the key is a value, return the corresponding symbol.

    • Return nil if the key is invalid.

Raises:

  • (NotImplementedError)


40
# File 'lib/helpers/interface/ienum.rb', line 40

def [](key); raise NotImplementedError; end

#symbolsArray

Returns The list of valid symbols of this enum.

Returns:

  • (Array)

    The list of valid symbols of this enum.

Raises:

  • (NotImplementedError)


33
# File 'lib/helpers/interface/ienum.rb', line 33

def symbols; raise NotImplementedError; end