Class: DryOpenApi::Paths

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
EquatableAsContent
Defined in:
lib/dry_open_api/paths.rb

Overview

Class Method Summary collapse

Instance Method Summary collapse

Methods included from EquatableAsContent

#==

Constructor Details

#initialize(**path_hash) ⇒ Paths

Returns a new instance of Paths.



7
8
9
# File 'lib/dry_open_api/paths.rb', line 7

def initialize(**path_hash)
  self.path_hash = path_hash.with_indifferent_access
end

Class Method Details

.load(hash) ⇒ Object



13
14
15
16
# File 'lib/dry_open_api/paths.rb', line 13

def self.load(hash)
  hash = hash.map { |k, v| [k.to_sym, PathItem.load(v)] }.to_h
  new(**hash)
end

Instance Method Details

#serializable_hashObject



18
19
20
# File 'lib/dry_open_api/paths.rb', line 18

def serializable_hash
  path_hash.map { |k, v| [k.to_s, v.serializable_hash] }.to_h
end