Class: EasyRspec::OriginalFile

Inherits:
Object
  • Object
show all
Defined in:
lib/easy_rspec/original_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass_name) ⇒ OriginalFile

Returns a new instance of OriginalFile.



6
7
8
# File 'lib/easy_rspec/original_file.rb', line 6

def initialize(klass_name)
  @klass_name = Object.const_get(klass_name.to_s)
end

Instance Attribute Details

#klass_nameObject (readonly)

Returns the value of attribute klass_name.



4
5
6
# File 'lib/easy_rspec/original_file.rb', line 4

def klass_name
  @klass_name
end

Instance Method Details

#directoryObject



14
15
16
# File 'lib/easy_rspec/original_file.rb', line 14

def directory
  @directory ||= path.split(name).first
end

#nameObject



18
19
20
# File 'lib/easy_rspec/original_file.rb', line 18

def name
  @name ||= path.split('/').last
end

#pathObject



10
11
12
# File 'lib/easy_rspec/original_file.rb', line 10

def path
  @path ||= FilePathFinder.new(@klass_name).file_path
end