class Objc2swiftAssistant::DirectoryNode

Attributes

child_directories[RW]
file_nodes_by_name[RW]
file_set[RW]
full_path[RW]
parent_node[RW]
pruned[RW]
relative_path[RW]

Public Class Methods

new(path, file_set) click to toggle source
# File lib/objc2swift_assistant/file_sets.rb, line 119
def initialize(path, file_set)
  @full_path = path
  @file_set = file_set

  if file_set.root == @full_path
    @parent_node = nil
  else
    @parent_node = file_set.directory_node_for_path( path.parent )
  end

  @relative_path = @full_path.relative_path_from( file_set.root )

  @child_directories = {}
  @file_nodes = {}
  @pruned = false
  @file_nodes_by_name = {}

  #todo: Apply settings

  unless @parent_node.nil?
    @parent_node.add_child_directory( self )
  end
end

Public Instance Methods

add_child_directory( child_node ) click to toggle source

Add a child directory. Mark the child as pruned if this node is pruned. Note that this keeps pruned nodes around which is desirable for reporting the effects of code generation

# File lib/objc2swift_assistant/file_sets.rb, line 145
def add_child_directory( child_node )
  @child_directories[ child_node.relative_path.basename().to_s ] = child_node
  child_node.pruned = @pruned
end
dump( indent, tab, errors_only ) click to toggle source
# File lib/objc2swift_assistant/file_sets.rb, line 150
def dump( indent, tab, errors_only )
  puts( indent + "Path: #{@relative_path.to_s}")
  puts( indent + "Files:") unless @file_nodes_by_name.length == 0
  @file_nodes_by_name.each_value { |file| file.dump( indent+tab, tab, errors_only ) }
  puts( "\n" + indent + "Child Directories:") unless @child_directories.length == 0
  @child_directories.each_value { |dir| dir.dump( indent+tab, tab, errors_only ) }
end