Sha256: 58a74d7b8100855cc0b5f255a8b38a39f2fcd4bf2cb165711ea6acf86a78fd8f
Contents?: true
Size: 907 Bytes
Versions: 4
Compression:
Stored size: 907 Bytes
Contents
require "uuid" module Render class Attribute SCHEMA_IDENTIFIERS = [:properties, :items].freeze attr_accessor :name, :type, :schema, :enums, :format, :required def initialize(options = {}) Render.logger.debug("Initializing attribute #{options}") self.required = false end def bias_type format || type end def default_value Render.live ? nil : faux_value end def nested_schema?(options = {}) options.any? { |name, value| SCHEMA_IDENTIFIERS.include?(name) } end private def process_type!(options) self.type = Type.parse!(options[:type]) self.format = Type.parse(options[:format]) if (options[:enum]) self.enums = options[:enum] self.format = Type::Enum end end def faux_value Generator.trigger(bias_type, name, self) end end end
Version data entries
4 entries across 4 versions & 1 rubygems