Sha256: b23e845f7139ccc4be41aa118d7d6e12024f8223166f444473850d6bb086588c

Contents?: true

Size: 347 Bytes

Versions: 5

Compression:

Stored size: 347 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.4 lib/soap-object/factory.rb
soap-object-0.5.1 lib/soap-object/factory.rb
soap-object-0.5 lib/soap-object/factory.rb
soap-object-0.4 lib/soap-object/factory.rb
soap-object-0.3 lib/soap-object/factory.rb