Class: Rfd::TreeNode

Inherits:
Struct
  • Object
show all
Defined in:
lib/rfd/navigation_window.rb

Overview

Tree node for directory tree browser

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#childrenObject

Returns the value of attribute children

Returns:

  • (Object)

    the current value of children



5
6
7
# File 'lib/rfd/navigation_window.rb', line 5

def children
  @children
end

#depthObject

Returns the value of attribute depth

Returns:

  • (Object)

    the current value of depth



5
6
7
# File 'lib/rfd/navigation_window.rb', line 5

def depth
  @depth
end

#expandedObject

Returns the value of attribute expanded

Returns:

  • (Object)

    the current value of expanded



5
6
7
# File 'lib/rfd/navigation_window.rb', line 5

def expanded
  @expanded
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



5
6
7
# File 'lib/rfd/navigation_window.rb', line 5

def name
  @name
end

#parentObject

Returns the value of attribute parent

Returns:

  • (Object)

    the current value of parent



5
6
7
# File 'lib/rfd/navigation_window.rb', line 5

def parent
  @parent
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



5
6
7
# File 'lib/rfd/navigation_window.rb', line 5

def path
  @path
end

#relative_pathObject

Returns the value of attribute relative_path

Returns:

  • (Object)

    the current value of relative_path



5
6
7
# File 'lib/rfd/navigation_window.rb', line 5

def relative_path
  @relative_path
end

Instance Method Details

#has_subdirs?Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
12
# File 'lib/rfd/navigation_window.rb', line 6

def has_subdirs?
  return false unless File.directory?(path)
  @has_subdirs = Dir.children(path).any? { |c| File.directory?(File.join(path, c)) } if @has_subdirs.nil?
  @has_subdirs
rescue Errno::EACCES, Errno::ENOENT, Errno::EPERM
  false
end