Class: Memoizable::MethodBuilder

### Home Classes Methods

### In Files

- lib/memoizable/method_builder.rb

### Parent

Object

### Namespace

- CLASS Memoizable::MethodBuilder::BlockNotAllowedError
- CLASS Memoizable::MethodBuilder::InvalidArityError

### Methods

- ::new
- #call

### Class/Module Index

Quicksearch

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

No matching classes.

# Memoizable::MethodBuilder

Build the memoized method

### Attributes

original_method[R]

The original method before memoization

@return [UnboundMethod]

@api public

### Public Class Methods

new(descendant, method_name, freezer) click to toggle source

Initialize an object to build a memoized method

@param [Module] descendant @param [Symbol] method_name @param [call] freezer

@return [undefined]

@api private

    # File lib/memoizable/method_builder.rb, line 54
    def initialize(descendant, method_name, freezer)
      @descendant          = descendant
      @method_name         = method_name
      @freezer             = freezer
      @original_visibility = visibility
      @original_method     = @descendant.instance_method(@method_name)
      assert_arity(@original_method.arity)
    end

### Public Instance Methods

call() click to toggle source

Build a new memoized method

@example

    method_builder.call  # => creates new method

@return [MethodBuilder]

@api public

    # File lib/memoizable/method_builder.rb, line 71
    def call
      remove_original_method
      create_memoized_method
      set_method_visibility
      self
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.