Sha256: a8760467d6d01d541adcc07c80a618545145ea28622b892e44efd0866dbf015a

Contents?: true

Size: 560 Bytes

Versions: 1

Compression:

Stored size: 560 Bytes

Contents

require "pathname"
require "filetree/simple_tree"

class Pathname
  alias :_parent :parent
  alias :_children :children
end

class FileTree < Pathname
  include SimpleTree

  attr_accessor :name, :id, :identifier

  def name
    @name ||= self.inspect
  end

  def id
    @id ||= self.inspect
  end

  def identifier
    @identifier ||= self.inspect
  end

  # See #Pathname.parent

  def parent
    FileTree.new(_parent)
  end

  #See #Pathname.children

  def children(*args)
    if self.directory?
      _children(*args)
    else
      []
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
filetree-0.0.1 lib/filetree.rb