Class: OasRails::Spec::Paths
- Inherits:
-
Object
- Object
- OasRails::Spec::Paths
- Includes:
- Specable
- Defined in:
- lib/oas_rails/spec/paths.rb
Instance Attribute Summary collapse
-
#path_items ⇒ Object
Returns the value of attribute path_items.
Instance Method Summary collapse
- #add_path(path) ⇒ Object
-
#initialize(specification) ⇒ Paths
constructor
A new instance of Paths.
- #to_spec ⇒ Object
Methods included from Specable
Constructor Details
#initialize(specification) ⇒ Paths
Returns a new instance of Paths.
8 9 10 11 |
# File 'lib/oas_rails/spec/paths.rb', line 8 def initialize(specification) @specification = specification @path_items = {} end |
Instance Attribute Details
#path_items ⇒ Object
Returns the value of attribute path_items.
6 7 8 |
# File 'lib/oas_rails/spec/paths.rb', line 6 def path_items @path_items end |
Instance Method Details
#add_path(path) ⇒ Object
13 14 15 |
# File 'lib/oas_rails/spec/paths.rb', line 13 def add_path(path) @path_items[path] = Builders::PathItemBuilder.new(@specification).from_path(path).build end |
#to_spec ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/oas_rails/spec/paths.rb', line 17 def to_spec paths_hash = {} @path_items.each do |path, path_object| paths_hash[path] = path_object.to_spec end paths_hash end |