Module: Taipo::Cache Private

Defined in:
lib/taipo/cache.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

A cache of TypeElement objects created from parsed type definitions

Since:

  • 1.0.0

Constant Summary collapse

@@Cache =

This classvariable is part of a private API. You should avoid using this classvariable if possible, as it may be removed or be changed in the future.

The hash that acts as the cache

Since:

  • 1.0.0

{}

Class Method Summary collapse

Class Method Details

.[](k) ⇒ Taipo::TypeElement, NilClass

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Retrieve the TypeElement object described by the type definition from the cache

Parameters:

  • k (String)

    the type definition

Returns:

  • (Taipo::TypeElement)

    if the type definition has been saved

  • (NilClass)

    if the type definition has not been saved

Since:

  • 1.0.0



25
26
27
# File 'lib/taipo/cache.rb', line 25

def self.[](k)
  @@Cache[k]
end

.[]=(k, v) ⇒ Taipo::TypeElement

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Save the TypeElement object described by the type definition in the cache

Parameters:

Returns:

Since:

  • 1.0.0



39
40
41
# File 'lib/taipo/cache.rb', line 39

def self.[]=(k,v)
  @@Cache[k] = v
end

.resetObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Reset the cache

Since:

  • 1.0.0



47
48
49
50
# File 'lib/taipo/cache.rb', line 47

def self.reset()
  @@Cache = {}
  return nil
end