Module: Adamantium::ModuleMethods

Defined in:
lib/adamantium/module_methods.rb

Overview

Methods mixed in to adamantium modules

Instance Method Summary collapse

Instance Method Details

#freezerFreezer::Deep

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.

Return default deep freezer

Returns:



13
14
15
# File 'lib/adamantium/module_methods.rb', line 13

def freezer
  Freezer::Deep
end

#memoize(*methods) ⇒ self

Memoize a list of methods

Examples:

memoize :hash

Parameters:

  • methods (Array<#to_s>)

    a list of methods to memoize

Returns:

  • (self)


28
29
30
31
32
33
# File 'lib/adamantium/module_methods.rb', line 28

def memoize(*methods)
  options        = methods.last.kind_of?(Hash) ? methods.pop : {}
  method_freezer = Freezer.parse(options) || freezer
  methods.each { |method| memoize_method(method, method_freezer) }
  self
end