Class: Based::BaseDirectory

Inherits:
Directory show all
Defined in:
lib/based.rb

Overview

An object representing the base directory

Instance Attribute Summary collapse

Attributes inherited from Directory

#base, #fullPath, #name, #parent, #pathElements, #relativePath

Instance Method Summary collapse

Methods inherited from Directory

#allFiles, #dirs, #files, #getEntries, #subDirs

Constructor Details

#initialize(path, options = {}) ⇒ BaseDirectory

Initialise from absolute file path. Options include :dirExclude, :fileInclude and :fileExclude



130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/based.rb', line 130

def initialize(path, options = {})
  super()
  @name = nil
  @parent = nil
  @base = self
  @relativePath = ""
  @pathElements = []
  @fullPath = path.end_with?("/") ? path : path + "/"
  @dirExclude = options.fetch(:dirExclude, nil)
  @fileInclude = options.fetch(:fileInclude, nil)
  @fileExclude = options.fetch(:fileExclude, nil)
end

Instance Attribute Details

#dirExcludeObject (readonly)

Function to decide if sub-directories should be excluded (if a directory is excluded, so are all it’s sub-directories and files contained within)



127
128
129
# File 'lib/based.rb', line 127

def dirExclude
  @dirExclude
end

#fileExcludeObject (readonly)

Function to decide if files should be excluded



123
124
125
# File 'lib/based.rb', line 123

def fileExclude
  @fileExclude
end

#fileIncludeObject (readonly)

Function to decide if files should be included (if nil, assume all included). Subject to exclusion by fileExclude



120
121
122
# File 'lib/based.rb', line 120

def fileInclude
  @fileInclude
end