Class: MethodMatch::NameExtractor
- Inherits:
-
Object
- Object
- MethodMatch::NameExtractor
- Defined in:
- lib/method_match/name_extractor.rb
Constant Summary collapse
- PWD =
"pwd"
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #base_directory ⇒ Object
- #final_name ⇒ Object
- #full_path ⇒ Object
-
#initialize(name) ⇒ NameExtractor
constructor
A new instance of NameExtractor.
- #project_path? ⇒ Boolean
- #pwd ⇒ Object
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
#name ⇒ Object
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_directory ⇒ Object
29 30 31 |
# File 'lib/method_match/name_extractor.rb', line 29 def base_directory full_path + File::SEPARATOR end |
#final_name ⇒ Object
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_path ⇒ Object
25 26 27 |
# File 'lib/method_match/name_extractor.rb', line 25 def full_path pwd.chomp end |
#project_path? ⇒ 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 |
#pwd ⇒ Object
21 22 23 |
# File 'lib/method_match/name_extractor.rb', line 21 def pwd `#{PWD}` end |