Sha256: b69b2c95a349f3c59c577b383afa3c5552c2823523df7e3eeef5aa5c0785c356

Contents?: true

Size: 586 Bytes

Versions: 7

Compression:

Stored size: 586 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_delegators :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

7 entries across 7 versions & 1 rubygems

Version Path
open_api-0.5.0 lib/open_api/paths.rb
open_api-0.4.0 lib/open_api/paths.rb
open_api-0.3.4 lib/open_api/paths.rb
open_api-0.3.3 lib/open_api/paths.rb
open_api-0.3.2 lib/open_api/paths.rb
open_api-0.3.1 lib/open_api/paths.rb
open_api-0.3.0 lib/open_api/paths.rb