`edit-method --patch --no-reload Foo#bar` doesn't work #731

Closed
kyrylo opened this Issue Oct 21, 2012 · 2 comments

Projects

None yet

2 participants

@kyrylo
Member
kyrylo commented Oct 21, 2012

Pry reloads Foo#bar anyway.

# foo.rb

class Foo
  def bar
    raise StandardError
  end

  def a
    :a
  end

  def b
    :b
  end
end
pry(main)> require './foo'
pry(main)> foo = Foo.new
pry(main)> foo.bar
StandardError: StandardError
from /home/curacao/code/pry/foo.rb:3:in `bar'
pry(main)> edit-method -n Foo#bar
# Editing... s/raise StandardError/:bar/
pry(main)> foo.bar
StandardError: StandardError
from /home/curacao/code/pry/foo.rb:3:in `bar'
pry(main)> edit-method -n -p Foo#bar
# Not editing anything. Just quitting the editor.
=> nil
pry(main)> foo.bar
=> :bar
@banister
Member

IMO it doesnt make sense to combine -n with -p since teh whole poing of -p (and the reason you'd use it) is to have code applied in pry only (not persisted to disk). Yet if you dont reload the code, it wont be eval'd in pry, making the use of the -p flag pointless to begin with.

Probably best to raise a bad option combinatino error in this case

@banister
Member

re-open if u feel the need, but i'm closing this bish

@banister banister closed this Jan 18, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment