Sha256: eb051673dbbb9fea40b114965fe5ba69fb9369ae9373fe749bac37dd949b8b95

Contents?: true

Size: 579 Bytes

Versions: 2

Compression:

Stored size: 579 Bytes

Contents

module OpenApi
  # https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#pathsObject
  class Paths
    extend Forwardable
    prepend EquatableAsContent

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

    def_delegator :path_hash, :[]

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

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

    private

    attr_accessor :path_hash
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
open_api-0.2.0 lib/open_api/paths.rb
open_api-0.1.0 lib/open_api/paths.rb