class Method
Public Instance Methods
*(g)
click to toggle source
Method composition.
@author Mike Burns
# File lib/facets/method/composition.rb, line 65 def *(g) Composition.new(self, g) end
^(n)
click to toggle source
Method repetition.
@author Mike Burns
# File lib/facets/method/composition.rb, line 72 def ^(n) if n < 2 self else Composistion.new(self, self ^ (n-1)) end end
memoize(value)
click to toggle source
Memoize a method by defining a singleton override.
NOTE: This method is not a common core extension and is not loaded
automatically when using require 'facets'
.
@uncommon
require 'facets/method/memoize'
# File lib/facets/method/memoize.rb, line 11 def memoize(value) singleton = (class << receiver; self; end) singleton.__send__(:define_method, name){ value } end