Class: Hashira::Coupling::Naming
- Inherits:
-
Object
- Object
- Hashira::Coupling::Naming
- Defined in:
- lib/hashira/coupling/naming.rb
Instance Method Summary collapse
-
#initialize(definitions) ⇒ Naming
constructor
A new instance of Naming.
- #segments ⇒ Object
- #strip(path) ⇒ Object
Constructor Details
#initialize(definitions) ⇒ Naming
Returns a new instance of Naming.
4 5 6 |
# File 'lib/hashira/coupling/naming.rb', line 4 def initialize(definitions) @definitions = definitions end |
Instance Method Details
#segments ⇒ Object
8 |
# File 'lib/hashira/coupling/naming.rb', line 8 def segments = @_segments ||= Hashira::Coupling::NamespacePrefix.infer(@definitions) |
#strip(path) ⇒ Object
10 11 12 13 |
# File 'lib/hashira/coupling/naming.rb', line 10 def strip(path) return [] if segments.first(path.length) == path path.drop(segments.length.downto(0).find { path.first(it) == segments.last(it) }) end |