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:
Kyrylo Silin 2013-09-25 10:47:39 +03:00
parent 022ca374af
commit b867523247
2 changed files with 11 additions and 10 deletions

View File

@ -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

View File

@ -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