Sha256: 32e2220ce89149b3573fcfc0305c8d3707a5e7f092027fb7a36c25dd94bf5864

Contents?: true

Size: 369 Bytes

Versions: 5

Compression:

Stored size: 369 Bytes

Contents

module SoapObject
  module Factory

    def using(cls, &block)
      @the_service = find_service(cls)
      block.call @the_service if block
      @the_service
    end

    private

    def find_service(cls)
      services[cls] = cls.new unless services[cls]
      services[cls]
    end

    def services
      @services ||= {}
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
soap-object-0.6.5 lib/soap-object/factory.rb
soap-object-0.6.3 lib/soap-object/factory.rb
soap-object-0.6.2 lib/soap-object/factory.rb
soap-object-0.6.1 lib/soap-object/factory.rb
soap-object-0.6 lib/soap-object/factory.rb