mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
command_helpers.rb: move set_file_and_dir_locals
from BaseHelpers
Partially fixes (probaby not at all) #705 (Helpers can't be used on their own) `set_file_and_dir_locals` is used *only* in commands.
This commit is contained in:
parent
022ca374af
commit
b867523247
2 changed files with 11 additions and 10 deletions
|
@ -42,15 +42,6 @@ class Pry
|
|||
end
|
||||
end
|
||||
|
||||
def set_file_and_dir_locals(file_name, _pry_=_pry_(), target=target())
|
||||
return if !target or !file_name
|
||||
_pry_.last_file = File.expand_path(file_name)
|
||||
_pry_.inject_local("_file_", _pry_.last_file, target)
|
||||
|
||||
_pry_.last_dir = File.dirname(_pry_.last_file)
|
||||
_pry_.inject_local("_dir_", _pry_.last_dir, target)
|
||||
end
|
||||
|
||||
def use_ansi_codes?
|
||||
windows_ansi? || ENV['TERM'] && ENV['TERM'] != "dumb"
|
||||
end
|
||||
|
@ -104,7 +95,7 @@ class Pry
|
|||
end
|
||||
|
||||
def mri_19?
|
||||
mri? && RUBY_VERSION =~ /1.9/
|
||||
mri? && RUBY_VERSION =~ /1.9/
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -149,6 +149,16 @@ class Pry
|
|||
|
||||
Range.new(a, b)
|
||||
end
|
||||
|
||||
def set_file_and_dir_locals(file_name, _pry_=_pry_(), target=target())
|
||||
return if !target or !file_name
|
||||
_pry_.last_file = File.expand_path(file_name)
|
||||
_pry_.inject_local("_file_", _pry_.last_file, target)
|
||||
|
||||
_pry_.last_dir = File.dirname(_pry_.last_file)
|
||||
_pry_.inject_local("_dir_", _pry_.last_dir, target)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue