Sha256: 1dae6570599fc473e89373ca37e4000c6dcb6f1efb5f77e1cda300be1ad13523

Contents?: true

Size: 645 Bytes

Versions: 2

Compression:

Stored size: 645 Bytes

Contents

module Qrb
  module Syntax
    module AdType
      include Support

      def compile(factory)
        name  = builtin_type_name
        clazz = name ? resolve_ruby_const(name.to_s) : nil
        factory.adt(clazz, compile_contracts(factory, clazz))
      end

      def compile_contracts(factory, clazz)
        contracts = {}
        captures[:contract].each do |node|
          contract = node.compile(factory, clazz)
          contracts.merge!(contract) do |k,_,_|
            raise Error, "Duplicate contract name `#{k}`"
          end
        end
        contracts
      end

    end # module AdType
  end # module Syntax
end # module Qrb

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qrb-0.2.0 lib/qrb/syntax/ad_type.rb
qrb-0.1.0 lib/qrb/syntax/ad_type.rb