Class: EnhancedPrompt::Prompt::Token::Dir

Inherits:
Object
  • Object
show all
Defined in:
lib/enhanced_prompt/token/dir.rb,
lib/enhanced_prompt/token/dir.rb

Instance Method Summary collapse

Instance Method Details

#dir_abbreviated1(limit = 50) ⇒ Object

TODO cd /home/sato/work/serverspec_test/spec/nyaa corrupt this if limit =40



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/enhanced_prompt/token/dir.rb', line 37

def dir_abbreviated1(limit=50)
  dir = _base
  if _dir_full.length >= limit then
    _dir.split_paths.reverse.each do |path|
      if dir.length + path.length <= limit
        dir = path + dir
      else
        return Pathname.new('...')+dir
      end
    end
    _dir_full
  else
    _dir_full
  end
end

#dir_fullObject



30
31
32
# File 'lib/enhanced_prompt/token/dir.rb', line 30

def dir_full
  _dir_full
end