Sha256: 6c0d25acdbc8a1df3e32420dd5831bd99f848a8b6885e9608e170f0c81358377
Contents?: true
Size: 671 Bytes
Versions: 16
Compression:
Stored size: 671 Bytes
Contents
require 'forwardable' module Jimmy class Definitions include SchemaCreation::Referencing extend Forwardable delegate %i[empty? key? map] => :@values attr_reader :schema def initialize(schema) @schema = schema @values = {} end def evaluate(&block) instance_exec &block end def domain schema.domain end def compile map { |k, v| [k.to_s, v.compile] }.to_h end def data schema.data end def [](key) @values[key] || (schema.parent && schema.parent.definitions[key]) end SchemaCreation.apply_to(self) { |schema, name| @values[name] = schema } end end
Version data entries
16 entries across 16 versions & 1 rubygems