Class: PathBuilder
- Inherits:
-
Struct
- Object
- Struct
- PathBuilder
- Defined in:
- lib/src/extractor.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
Returns the value of attribute base.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#tag ⇒ Object
Returns the value of attribute tag.
Instance Method Summary collapse
Instance Attribute Details
#base ⇒ Object
Returns the value of attribute base
7 8 9 |
# File 'lib/src/extractor.rb', line 7 def base @base end |
#parent ⇒ Object
Returns the value of attribute parent
7 8 9 |
# File 'lib/src/extractor.rb', line 7 def parent @parent end |
#tag ⇒ Object
Returns the value of attribute tag
7 8 9 |
# File 'lib/src/extractor.rb', line 7 def tag @tag end |
Instance Method Details
#build ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/src/extractor.rb', line 8 def build paths = relative_path.split("/").then do |paths| if parent.present? navigate_to_parent(parent, paths) else paths end end paths << tag unless tag.is_a? Array full_path = paths.flatten.compact.join("/") "//#{full_path}" end |