Class: Upstream::PathFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/upstream.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arg) ⇒ PathFinder

Returns a new instance of PathFinder.



26
27
28
# File 'lib/upstream.rb', line 26

def initialize(arg)
  @raw_path = arg
end

Instance Attribute Details

#raw_pathObject (readonly)

Returns the value of attribute raw_path.



24
25
26
# File 'lib/upstream.rb', line 24

def raw_path
  @raw_path
end

Class Method Details

.get_path(arg) ⇒ Object



30
31
32
# File 'lib/upstream.rb', line 30

def self.get_path(arg)
  new(arg).parse
end

Instance Method Details

#parseObject



34
35
36
37
38
39
40
# File 'lib/upstream.rb', line 34

def parse
  if raw_path == '.'
    `pwd`.chomp
  else
    raw_path
  end
end