Sha256: 6bec1992c562ad4cde1f90763103cee2913d7823716d18fc8cfb18becd998303

Contents?: true

Size: 390 Bytes

Versions: 1

Compression:

Stored size: 390 Bytes

Contents

# frozen_string_literal: true

class OAPI::Types::Object
  using OAPI::Monkey

  include OAPI::Properties

  class << self
    def parse(json)
      new.tap do |obj|
        properties.each do |name, type|
          value = json[name.camelize]
          next if value.nil?

          value = type.parse(value) if type
          obj.send(name, value)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
oapi-0.1.2 lib/oapi/types/object.rb