class Aruba::ArubaPath

@private
Pathname for aruba files and directories

def [](index)

Parameters:
  • index (Integer, Range) --
def [](index)
  to_s[index]
end

def initialize(path)

def initialize(path)
  @obj = [path.to_s].flatten
end

def pop

puts path # => path/to
path.pop
path.push 'dir'
path = ArubaPath.new 'path/to'
@example

Remove last pushed component of path
def pop
  @obj.pop
end

def push(p)

Parameters:
  • p (String) --
def push(p)
  @obj << p
end

def to_pathname

Get path
def to_pathname
  current_path = @obj.inject do |path, element|
    if element.start_with?("~") ||
       Aruba.platform.absolute_path?(element)
      element
    else
      File.join(path, element)
    end
  end
  ::Pathname.new(current_path)
end

def to_s

def to_s
  to_str
end

def to_str

def to_str
  to_pathname.to_s
end