Class: Fried::Test::Directory::CurrentWorkingDirectory

Inherits:
Object
  • Object
show all
Defined in:
lib/fried/test/directory/current_working_directory.rb

Defined Under Namespace

Classes: Substitute

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dirObject

Returns the value of attribute dir.



23
24
25
# File 'lib/fried/test/directory/current_working_directory.rb', line 23

def dir
  @dir
end

Class Method Details

.buildObject



25
26
27
28
29
# File 'lib/fried/test/directory/current_working_directory.rb', line 25

def self.build
  new.tap do |instance|
    instance.dir = Dir
  end
end

.callObject



39
40
41
42
# File 'lib/fried/test/directory/current_working_directory.rb', line 39

def self.call
  instance = build
  instance.()
end

Instance Method Details

#callPathname

Returns:

  • (Pathname)


32
33
34
35
36
37
# File 'lib/fried/test/directory/current_working_directory.rb', line 32

def call
  return Pathname.new("/dev/null") if dir.nil?

  path_as_text = dir.pwd
  Pathname.new(path_as_text)
end