Class: Pry::Method::Patcher

Inherits:
Object show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/method/patcher.rb

Constant Summary collapse

@@source_cache =

rubocop:disable Style/ClassVars

{}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method) ⇒ Patcher

rubocop:enable Style/ClassVars



12
13
14
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/method/patcher.rb', line 12

def initialize(method)
  @method = method
end

Instance Attribute Details

#methodObject

Returns the value of attribute method.



6
7
8
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/method/patcher.rb', line 6

def method
  @method
end

Class Method Details

.code_for(filename) ⇒ Object



16
17
18
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/method/patcher.rb', line 16

def self.code_for(filename)
  @@source_cache[filename]
end

Instance Method Details

#patch_in_ram(source) ⇒ Object

perform the patch



21
22
23
24
25
26
27
28
29
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/method/patcher.rb', line 21

def patch_in_ram(source)
  if method.alias?
    with_method_transaction do
      redefine source
    end
  else
    redefine source
  end
end