Class: Hashira::Analysis::Naming
- Inherits:
-
Object
- Object
- Hashira::Analysis::Naming
- Defined in:
- lib/hashira/analysis/naming.rb
Instance Attribute Summary collapse
-
#segments ⇒ Object
readonly
Returns the value of attribute segments.
Instance Method Summary collapse
-
#initialize(definitions) ⇒ Naming
constructor
A new instance of Naming.
- #strip(path) ⇒ Object
Constructor Details
#initialize(definitions) ⇒ Naming
Returns a new instance of Naming.
4 5 6 |
# File 'lib/hashira/analysis/naming.rb', line 4 def initialize(definitions) @segments = Hashira::Analysis::NamespacePrefix.infer(definitions) end |
Instance Attribute Details
#segments ⇒ Object (readonly)
Returns the value of attribute segments.
8 9 10 |
# File 'lib/hashira/analysis/naming.rb', line 8 def segments @segments end |
Instance Method Details
#strip(path) ⇒ Object
10 11 12 13 |
# File 'lib/hashira/analysis/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 |