Sha256: d476d2e6535bc12c961b012881d40a1b090e3aaba54f05cfc1ced02c5ef3cfb0

Contents?: true

Size: 1.33 KB

Versions: 27

Compression:

Stored size: 1.33 KB

Contents

Foobara.require_project_file("type_declarations", "desugarizer")
Foobara.require_project_file("type_declarations", "handlers/extend_associative_array_type_declaration")
Foobara.require_project_file("type_declarations", "handlers/extend_attributes_type_declaration/hash_desugarizer")

module Foobara
  module TypeDeclarations
    module Handlers
      class ExtendAttributesTypeDeclaration < ExtendAssociativeArrayTypeDeclaration
        # TODO: make a quick way to convert a couple simple procs into a transformer
        class ElementTypeDeclarationsDesugarizer < HashDesugarizer
          def desugarize(sugary_type_declaration)
            sugary_type_declaration = sugary_type_declaration.dup

            sugary_type_declaration[:element_type_declarations] =
              sugary_type_declaration[:element_type_declarations].to_h do |attribute_name, element_type_declaration|
                if attribute_name != :_desugarized
                  handler = type_declaration_handler_for(element_type_declaration)
                  element_type_declaration = handler.desugarize(element_type_declaration)
                end

                [attribute_name, element_type_declaration]
              end

            sugary_type_declaration
          end

          def priority
            Priority::LOW
          end
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
foobara-0.0.7 projects/type_declarations/src/handlers/extend_attributes_type_declaration/element_type_declarations_desugarizer.rb
foobara-0.0.6 projects/type_declarations/src/handlers/extend_attributes_type_declaration/element_type_declarations_desugarizer.rb
foobara-0.0.5 projects/type_declarations/src/handlers/extend_attributes_type_declaration/element_type_declarations_desugarizer.rb
foobara-0.0.4 projects/type_declarations/src/handlers/extend_attributes_type_declaration/element_type_declarations_desugarizer.rb
foobara-0.0.3 projects/type_declarations/src/handlers/extend_attributes_type_declaration/element_type_declarations_desugarizer.rb
foobara-0.0.2 projects/type_declarations/src/handlers/extend_attributes_type_declaration/element_type_declarations_desugarizer.rb
foobara-0.0.1 projects/type_declarations/src/handlers/extend_attributes_type_declaration/element_type_declarations_desugarizer.rb