Sha256: 9d0ab275a177cd4ccfa8d29650257e167bffd49c941247cf6702649bf94fbb4e

Contents?: true

Size: 1.3 KB

Versions: 5

Compression:

Stored size: 1.3 KB

Contents

require_relative 'factory/union'
require_relative 'factory/sbyc'
require_relative 'factory/scalar'
require_relative 'factory/reuse'
module Domain
  module Factory
    
    # Creates a domain through specialization by constraint
    #
    # @param [Class] super_domain
    #   the super_domain of the factored domain
    # @param [Proc] pred
    #   the domain predicate
    #
    # @return [Class]
    #   the created domain as a ruby Class
    #
    # @api public
    def sbyc(super_domain = Object, &pred)
      Class.new(super_domain){ extend SByC.new(super_domain, pred) }
    end

    # Factors a union domain
    #
    # @param [Class] super_domain
    #   the super_domain of the factored domain
    # @param [Array] sub_domains
    #   an array of sub domains for the factored domain
    #
    # @return [Class]
    #   the created domain as a ruby Class
    #
    # @api public
    def union(*sub_domains)
      Class.new{ extend Union.new(*sub_domains) }
    end

    # Factors a scalar domain
    #
    # @param [Array] component_names
    #   the component names as an array of symbols
    #
    # @return [Class]
    #   the created domain as a ruby Class
    #
    # @api public
    def scalar(*component_names)
      Class.new{ extend Scalar.new(*component_names) }
    end

  end # module Factory
end # module Domain

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
domain-1.0.0 lib/domain/factory.rb
domain-1.0.0.rc4 lib/domain/factory.rb
domain-1.0.0.rc3 lib/domain/factory.rb
domain-1.0.0.rc2 lib/domain/factory.rb
domain-1.0.0.rc1 lib/domain/factory.rb