Sha256: 93ad6c69dc552be2ebd768ee5507461c5a7c9b24dcc8150e5f35f702dd265d95

Contents?: true

Size: 932 Bytes

Versions: 38

Compression:

Stored size: 932 Bytes

Contents

module Foobara
  module TypeDeclarations
    module Handlers
      class ExtendModelTypeDeclaration < ExtendRegisteredTypeDeclaration
        class HashDesugarizer < TypeDeclarations::Desugarizer
          def applicable?(sugary_type_declaration)
            return false unless sugary_type_declaration.is_a?(::Hash)
            return false unless Util.all_symbolizable_keys?(sugary_type_declaration)

            sugary_type_declaration = Util.symbolize_keys(sugary_type_declaration)

            return true unless sugary_type_declaration.key?(:type)

            sugary_type_declaration[:type] == expected_type_symbol
          end

          def expected_type_symbol
            :model
          end

          def desugarize(sugary_type_declaration)
            Util.symbolize_keys(sugary_type_declaration)
          end

          def priority
            Priority::HIGH
          end
        end
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
foobara-0.0.38 projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb
foobara-0.0.37 projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb
foobara-0.0.36 projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb
foobara-0.0.35 projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb
foobara-0.0.34 projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb
foobara-0.0.33 projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb
foobara-0.0.32 projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb
foobara-0.0.31 projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb
foobara-0.0.30 projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb
foobara-0.0.29 projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb
foobara-0.0.28 projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb
foobara-0.0.27 projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb
foobara-0.0.26 projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb
foobara-0.0.25 projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb
foobara-0.0.24 projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb
foobara-0.0.23 projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb
foobara-0.0.22 projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb
foobara-0.0.21 projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb
foobara-0.0.20 projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb
foobara-0.0.19 projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb