Sha256: ff740fc334c490e2d197bc8c931a5c8777874094f63b9c818c4b96d5d2a2e3de

Contents?: true

Size: 624 Bytes

Versions: 4

Compression:

Stored size: 624 Bytes

Contents

# = basefactory.rb

require 'facets/core/module/class_extension'

# BaseFactory

module BaseFactory

  def self.included( base )
    class << base
      alias :instance :new
    end
  end

  class_extension {

    # Factory-pattern initialization.

    def new(type, *set, &yld)
      #begin
        send(type, *set, &yld)
      #rescue
      #  raise FactoryError, "Not a known #{self} -- #{type}."
      #end
    end

    # Subclasses should have standard #new methods.

    def inherited( subclass )
      class << subclass
        alias :new :instance
      end
    end

  }

end

class FactoryError < ArgumentError
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
facets-1.8.0 work/pore/basefactory.rb
facets-1.8.20 work/pore/basefactory.rb
facets-1.8.49 work/pore/basefactory.rb
facets-1.8.8 work/pore/basefactory.rb