Class: RubyDetective::SourceRepresentation::Entities::Base
- Inherits:
-
Object
- Object
- RubyDetective::SourceRepresentation::Entities::Base
- Defined in:
- lib/ruby_detective/source_representation/entities/base.rb
Constant Summary collapse
- ROOT_SIGN_SYMBOL =
:"::"
Instance Method Summary collapse
- #absolute_path? ⇒ Boolean
- #namespace_as_text ⇒ Object
-
#namespace_without_root_sign ⇒ Object
Removes the :“::” symbol from the namespace.
- #path ⇒ Object
- #path_as_text ⇒ Object
- #path_without_root_sign ⇒ Object
Instance Method Details
#absolute_path? ⇒ Boolean
7 8 9 |
# File 'lib/ruby_detective/source_representation/entities/base.rb', line 7 def absolute_path? namespace.first == ROOT_SIGN_SYMBOL end |
#namespace_as_text ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/ruby_detective/source_representation/entities/base.rb', line 36 def namespace_as_text if absolute_path? "::" + namespace_without_root_sign.join("::") else namespace.join("::") end end |
#namespace_without_root_sign ⇒ Object
Removes the :“::” symbol from the namespace
20 21 22 23 24 25 26 |
# File 'lib/ruby_detective/source_representation/entities/base.rb', line 20 def namespace_without_root_sign if absolute_path? namespace[1..-1] else namespace end end |
#path ⇒ Object
11 12 13 |
# File 'lib/ruby_detective/source_representation/entities/base.rb', line 11 def path namespace + [name] end |
#path_as_text ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/ruby_detective/source_representation/entities/base.rb', line 28 def path_as_text if absolute_path? "::" + path_without_root_sign.join("::") else path.join("::") end end |
#path_without_root_sign ⇒ Object
15 16 17 |
# File 'lib/ruby_detective/source_representation/entities/base.rb', line 15 def path_without_root_sign namespace_without_root_sign + [name] end |