Class: Meta::SwaggerDocUtil::Path
- Inherits:
-
Object
- Object
- Meta::SwaggerDocUtil::Path
- Defined in:
- lib/meta/swagger_doc.rb
Class Method Summary collapse
Instance Method Summary collapse
- #append(part) ⇒ Object
-
#initialize(parts = []) ⇒ Path
constructor
A new instance of Path.
- #to_s ⇒ Object
Constructor Details
#initialize(parts = []) ⇒ Path
Returns a new instance of Path.
67 68 69 |
# File 'lib/meta/swagger_doc.rb', line 67 def initialize(parts = []) @parts = parts.freeze end |
Class Method Details
.from_string(path) ⇒ Object
82 83 84 85 86 |
# File 'lib/meta/swagger_doc.rb', line 82 def self.from_string(path) path = path[1..-1] if path.start_with?('/') parts = path.split('/') self.class.new(parts) end |
Instance Method Details
#append(part) ⇒ Object
71 72 73 74 75 76 |
# File 'lib/meta/swagger_doc.rb', line 71 def append(part) part = part[1..-1] if part.start_with?('/') parts = part.split('/') self.class.new(@parts + parts) end |
#to_s ⇒ Object
78 79 80 |
# File 'lib/meta/swagger_doc.rb', line 78 def to_s '/' + @parts.join('/') end |