Sha256: 5f89fd7834ca9163068b935fe7ef285caa389bf714780b4c6c90176ad7655032
Contents?: true
Size: 677 Bytes
Versions: 3
Compression:
Stored size: 677 Bytes
Contents
module Jimmy class Reference include SchemaCreation::MetadataMethods attr_reader :uri, :data def initialize(uri, nullable = false, *args, **opts, &block) @uri = uri @nullable = nullable @data = {} args.each { |arg| __send__ arg } opts.each { |arg| __send__ *arg } instance_exec &block if block end def compile data.merge(nullable? ? { 'anyOf' => [ {'type' => 'null'}, ref_hash ] } : ref_hash ) end def nullable? @nullable end private def ref_hash {'$ref' => uri} end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
jimmy-0.5.0 | lib/jimmy/reference.rb |
jimmy-0.4.8 | lib/jimmy/reference.rb |
jimmy-0.4.7 | lib/jimmy/reference.rb |