module Unparser::Adamantium::ModuleMethods

def memoize(*methods)

Other tags:
    Api: - public

Returns:
  • (self) -

Parameters:
  • methods (Array<#to_s>) --
def memoize(*methods)
  methods.each(&method(:memoize_method))
  self
end

def memoize_method(method_name)

def memoize_method(method_name)
  if memoized_methods.key?(method_name)
    fail ArgumentError, "##{method_name} is already memoized"
  end
  memoized_methods[method_name] = MethodBuilder.new(self, method_name).call
end

def memoized?(method_name)

Returns:
  • (Bool) -

Parameters:
  • name (Symbol) --
def memoized?(method_name)
  memoized_methods.key?(method_name)
end

def memoized_methods

def memoized_methods
  @memoized_methods ||= {}
end

def unmemoized_instance_method(method_name)

Other tags:
    Api: - public

Raises:
  • (NameError) -

Returns:
  • (UnboundMethod) -

Parameters:
  • name (Symbol) --
def unmemoized_instance_method(method_name)
  memoized_methods.fetch(method_name) do
    fail ArgumentError, "##{method_name} is not memoized"
  end
end