spaceship/lib/spaceship/base.rb in fastlane-2.14.2 vs spaceship/lib/spaceship/base.rb in fastlane-2.15.0.beta.20170213032052

- old
+ new

@@ -156,9 +156,27 @@ klass.set_client(@client) else super end end + + ## + # The factory class-method. This should only be used or overridden in very specific use-cases + # + # The only time it makes sense to use or override this method is when we want a base class + # to return a sub-class based on attributes. + # + # Here, we define the method to be the same as `Spaceship::Base.new(attrs)`, be it should + # be used only by classes that override it. + # + # Example: + # + # Certificate.factory(attrs) + # #=> #<PushCertificate ... > + # + def factory(attrs) + self.new(attrs) + end end ## # @return (Spaceship::Client) The current spaceship client used by the model to make requests. attr_reader :client