Sha256: d1630030f6c426108333c2e1a599f2064faac14c7e16d2edd5adeca0c79ec4c9
Contents?: true
Size: 463 Bytes
Versions: 3
Compression:
Stored size: 463 Bytes
Contents
# frozen_string_literal: true class OAPI::Types::Array < OAPI::Types::Object attr_reader :store def initialize(store = [], &) @store = store super(&) end class << self attr_reader :item_name, :item_type def item(name, type) @item_name = name @item_type = type define_method(name) do |&block| @store << type.new(&block) end end def parse(json) = new(json.map { item_type.parse(_1) }) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
oapi-0.1.2 | lib/oapi/types/array.rb |
oapi-0.1.1 | lib/oapi/types/array.rb |
oapi-0.1.0 | lib/oapi/types/array.rb |