class PrySorbet::UnwrapCommand
Public Instance Methods
process()
click to toggle source
# File lib/pry-sorbet/commands/unwrap_command.rb, line 16 def process return unless defined?(T::Private::Methods) # For each signature wrapper, call the lambda associated with the wrapper # to finalize the method wrapping sig_wrappers = T::Private::Methods.instance_variable_get(:@sig_wrappers) || {} sig_wrappers.values.each do |sig_wrapper| sig_wrapper.call rescue NameError end # Now that all methods are properly wrapped with optimized wrappers # we can replace them with the original methods signatures_by_method = T::Private::Methods.instance_variable_get(:@signatures_by_method) || {} signatures_by_method.values.each do |signature| T::Configuration.without_ruby_warnings do T::Private::DeclState.current.without_on_method_added do if signature.mode == T::Private::Methods::Modes.abstract signature.owner.send(:remove_method, signature.method_name) else signature.owner.send(:define_method, signature.method_name, signature.method) end end end end end