Class: RVC::Location

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root) ⇒ Location

Returns a new instance of Location.



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

def initialize root
  @stack = [['', root]]
end

Instance Attribute Details

#stackObject (readonly)

Returns the value of attribute stack.



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

def stack
  @stack
end

Instance Method Details

#initialize_copy(src) ⇒ Object



30
31
32
33
# File 'lib/rvc/fs.rb', line 30

def initialize_copy src
  super
  @stack = @stack.dup
end

#objObject



43
44
45
# File 'lib/rvc/fs.rb', line 43

def obj
  @stack.empty? ? nil : @stack[-1][1]
end

#pathObject



47
48
49
# File 'lib/rvc/fs.rb', line 47

def path
  @stack.map { |name,obj| name }
end

#popObject



39
40
41
# File 'lib/rvc/fs.rb', line 39

def pop
  @stack.pop
end

#push(name, obj) ⇒ Object



35
36
37
# File 'lib/rvc/fs.rb', line 35

def push name, obj
  @stack << [name, obj]
end