Class: MethodMatch::NameExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/method_match/name_extractor.rb

Constant Summary collapse

PWD =
"pwd"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ NameExtractor

Returns a new instance of NameExtractor.



8
9
10
# File 'lib/method_match/name_extractor.rb', line 8

def initialize name
  @name = name
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/method_match/name_extractor.rb', line 4

def name
  @name
end

Instance Method Details

#base_directoryObject



29
30
31
# File 'lib/method_match/name_extractor.rb', line 29

def base_directory
  full_path + File::SEPARATOR
end

#final_nameObject



12
13
14
15
# File 'lib/method_match/name_extractor.rb', line 12

def final_name
  @name.slice! base_directory if project_path?
  name
end

#full_pathObject



25
26
27
# File 'lib/method_match/name_extractor.rb', line 25

def full_path
  pwd.chomp
end

#project_path?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/method_match/name_extractor.rb', line 17

def project_path?
  name.index( full_path ) && name.index( full_path ).zero?
end

#pwdObject



21
22
23
# File 'lib/method_match/name_extractor.rb', line 21

def pwd
  `#{PWD}`
end