Sha256: d3ff94b065e5981fa3e923f6e8e52112e67c08e60811a1fd2d929294b53f9f2e
Contents?: true
Size: 961 Bytes
Versions: 26
Compression:
Stored size: 961 Bytes
Contents
module Foobara module TypeDeclarations module Handlers class ExtendRegisteredModelTypeDeclaration < ExtendRegisteredTypeDeclaration class NormalizeMutableAttributesDesugarizer < TypeDeclarations::Desugarizer def applicable?(value) if value.is_a?(::Hash) && value.key?(:mutable) && value.key?(:type) mutable = value[:mutable] return false if [true, false].include?(mutable) if !mutable.is_a?(::Array) || (mutable.is_a?(::Array) && mutable.any? { |k| !k.is_a?(::Symbol) }) type = type_for_declaration(value[:type]) type.extends?(BuiltinTypes[:model]) end end end def desugarize(rawish_type_declaration) rawish_type_declaration.merge( mutable: Util.array(rawish_type_declaration[:mutable]).map!(&:to_sym) ) end end end end end end
Version data entries
26 entries across 26 versions & 1 rubygems