Sha256: 400784b5199547976828a3eddef33343611884f7024158053b8d28735b0148d9

Contents?: true

Size: 692 Bytes

Versions: 25

Compression:

Stored size: 692 Bytes

Contents

module Sprout::Executable

  ##
  # A factory to create concrete Executable::Param
  # entities from a set of known types.
  #
  # If an unrecognized Class reference is provided
  # we will instantiate it and ensure that it 
  # responds to the public members of the 
  # Executable::Param interface.
  class ParameterFactory

    class << self

      def create type
        # Didn't want to clobber the stdlib references
        # to these two important data types...
        # But wanted to keep the add_param interface
        # clean and simple.
        return StringParam.new if type == String
        return FileParam.new if type == File
        type.new
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
sprout-1.0.4.pre lib/sprout/executable/parameter_factory.rb
sprout-1.0.3.pre lib/sprout/executable/parameter_factory.rb
sprout-1.0.2.pre lib/sprout/executable/parameter_factory.rb
sprout-1.0.1.pre lib/sprout/executable/parameter_factory.rb
sprout-1.0.0.pre lib/sprout/executable/parameter_factory.rb