Module: Unparser::Adamantium::ModuleMethods
- Defined in:
- lib/unparser/adamantium.rb
Overview
Methods mixed in to adamantium modules
Instance Method Summary collapse
-
#memoize(*methods) ⇒ self
Memoize a list of methods.
-
#memoized?(method_name) ⇒ Bool
Test if method is memoized.
-
#unmemoized_instance_method(method_name) ⇒ UnboundMethod
Return unmemoized instance method.
Instance Method Details
#memoize(*methods) ⇒ self
Memoize a list of methods
96 97 98 99 |
# File 'lib/unparser/adamantium.rb', line 96 def memoize(*methods) methods.each(&method(:memoize_method)) self end |
#memoized?(method_name) ⇒ Bool
Test if method is memoized
106 107 108 |
# File 'lib/unparser/adamantium.rb', line 106 def memoized?(method_name) memoized_methods.key?(method_name) end |
#unmemoized_instance_method(method_name) ⇒ UnboundMethod
Return unmemoized instance method
121 122 123 124 125 |
# File 'lib/unparser/adamantium.rb', line 121 def unmemoized_instance_method(method_name) memoized_methods.fetch(method_name) do fail ArgumentError, "##{method_name} is not memoized" end end |