Class: Trax::Core::FS::CurrentFileDirectory

Inherits:
SimpleDelegator
  • Object
show all
Includes:
Enumerable
Defined in:
lib/trax/core/fs.rb

Direct Known Subclasses

CurrentDirectory

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Enumerable

#group_by_count

Constructor Details

#initializeCurrentFileDirectory

Returns a new instance of CurrentFileDirectory.



165
166
167
168
169
# File 'lib/trax/core/fs.rb', line 165

def initialize
  source_file_path = caller[3].partition(":")[0]
  @path = ::Pathname.new(::File.dirname(source_file_path))
  @directory = ::Trax::Core::FS::Directory.new(@path)
end

Instance Attribute Details

#directoryObject

Returns the value of attribute directory.



163
164
165
# File 'lib/trax/core/fs.rb', line 163

def directory
  @directory
end

#pathObject

Returns the value of attribute path.



163
164
165
# File 'lib/trax/core/fs.rb', line 163

def path
  @path
end

Class Method Details

.[](path) ⇒ Object



158
159
160
161
# File 'lib/trax/core/fs.rb', line 158

def self.[](path)
  file_path = path.is_a?(::Pathname) ? path : ::Pathname.new(path)
  new(file_path)
end

Instance Method Details

#__getobj__Object



171
172
173
# File 'lib/trax/core/fs.rb', line 171

def __getobj__
  @directory
end

#each {|@directory| ... } ⇒ Object

Yields:



175
176
177
# File 'lib/trax/core/fs.rb', line 175

def each
  yield @directory
end