Sha256: 8d1f7a8235e6a468e903e8187f4a467e4064b58745af8cf15f4a5c2961fe3807

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

module Domain
  module API

    # Returns the super domain of `self`.
    #
    # @return [Class]
    #   the super domain of `self` as a ruby class
    #
    # @api public
    def super_domain
      superclass
    end

    # Returns the sub domains of `self`.
    #
    # @return [Array]
    #   an array of sub domains (possibly empty)
    #
    # @api public
    def sub_domains
      []
    end

    # Returns true if this domain is a super domain of `dom`.
    #
    # @param [Class] dom
    #   a domain
    #
    # @return [Boolean]
    #   true if self is a super domain of `dom`, false otherwise
    #
    # @api public
    def super_domain_of?(dom)
      sub_domains.include?(dom)
    end

    # Raises a type error for `args`.
    #
    # @param [Array] args
    #   arguments passed to `new` or another factory method
    # @raise TypeError
    #
    # @api protected
    def domain_error!(first, *args)
      first = [first]+args unless args.empty?
      raise TypeError, "Can't convert `#{first.inspect}` into #{self}", caller
    end
    protected :domain_error!

  end # module API
end # module Domain

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
domain-1.0.0.rc2 lib/domain/api.rb