Module: Memoizable::ModuleMethods

### Home Classes Methods

### In Files

- lib/memoizable/module_methods.rb

### Methods

- #freezer
- #memoize
- #memoized?
- #unmemoized_instance_method

### Included Modules

- Memoizable

### Class/Module Index

Quicksearch

- Memoizable
- Memoizable::InstanceMethods
- Memoizable::Memory
- Memoizable::MethodBuilder
- Memoizable::MethodBuilder::BlockNotAllowedError
- Memoizable::MethodBuilder::InvalidArityError
- Memoizable::ModuleMethods

No matching classes.

# Memoizable::ModuleMethods

Methods mixed in to memoizable singleton classes

### Public Instance Methods

freezer() click to toggle source

Return default deep freezer

@return [call]

@api private

    # File lib/memoizable/module_methods.rb, line 12
    def freezer
      Freezer
    end

memoize(*methods) click to toggle source

Memoize a list of methods

@example

    memoize :hash

@param [Array<Symbol>] methods

    a list of methods to memoize

@return [self]

@api public

    # File lib/memoizable/module_methods.rb, line 27
    def memoize(*methods)
      methods.each(&method(:memoize_method))
      self
    end

memoized?(name) click to toggle source

Test if an instance method is memoized

@example

    class Foo
      include Memoizable

      def bar
      end
      memoize :bar
    end

    Foo.memoized?(:bar)  # true
    Foo.memoized?(:baz)  # false

@param [Symbol] name

@return [Boolean]

    true if method is memoized, false if not

@api private

    # File lib/memoizable/module_methods.rb, line 52
    def memoized?(name)
      memoized_methods.key?(name)
    end

unmemoized_instance_method(name) click to toggle source

Return unmemoized instance method

@example

    class Foo
      include Memoizable

      def bar
      end
      memoize :bar
    end

    Foo.unmemoized_instance_method(:bar)

@param [Symbol] name

@return [UnboundMethod]

    the memoized method

@raise [NameError]

    raised if the method is unknown

@api public

    # File lib/memoizable/module_methods.rb, line 79
    def unmemoized_instance_method(name)
      memoized_methods[name].original_method
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.