Class: Unparser::Adamantium::MethodBuilder
- Inherits:
-
Object
- Object
- Unparser::Adamantium::MethodBuilder
- Defined in:
- lib/unparser/adamantium/method_builder.rb
Overview
Build the memoized method
Defined Under Namespace
Classes: BlockNotAllowedError, InvalidArityError
Instance Method Summary collapse
-
#call ⇒ UnboundMethod
Build a new memoized method.
-
#initialize(descendant, method_name) ⇒ undefined
constructor
private
Initialize an object to build a memoized method.
Constructor Details
#initialize(descendant, method_name) ⇒ undefined
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize an object to build a memoized method
47 48 49 50 51 52 53 |
# File 'lib/unparser/adamantium/method_builder.rb', line 47 def initialize(descendant, method_name) @descendant = descendant @method_name = method_name @original_visibility = visibility @original_method = @descendant.instance_method(@method_name) assert_arity(@original_method.arity) end |
Instance Method Details
#call ⇒ UnboundMethod
Build a new memoized method
63 64 65 66 67 68 |
# File 'lib/unparser/adamantium/method_builder.rb', line 63 def call remove_original_method create_memoized_method set_method_visibility @original_method end |