...winner.promise() @all: (promises) -> # Pass an additional resolved deferred to $.when so $.when will # not return the given deferred if only one deferred is passed. $.when(@resolve(), promises...) @reject: (value) ->
...setting it as a simple attribute will do. Easy workaround Define a method that returns the constant and stub that method: class Earth TILT = 23.4 #degree def self.tilt TILT
^ Earth.should_receive(:tilt).and_return 10.5 # or Earth.stub :tilt => 10.5 Sometimes you can't add this method and must have that CONSTANT there. Master mode is for you.
...substring (no ^ and $ markers at the beginning and end), you are still expected to return a replacement for the whole string that was piped through the transform. If you don...
Best results in other decks
...String, Integer, Float, Boolean, Array, Hash Control flow: if, each, case, break... Functions: def, return, implicit return in methods and blocks Errors, raise and rescue Classes and inheritance The difference...
...addresses.size # => 3 Now write a method AddressBook#search that takes a query string and returns an array of Contact objects that match the given word in any of their properties...
...What are "synchronous" or "blocking" APIs versus "asynchronous" APIs? Why does fetch() not simply return the response from the server? Why is asynchronous code such a big issue in JavaScript...
...Stub function that resolves after 100 milliseconds, could be an API call function backgroundTask() { return new Promise((resolve) => setTimeout(resolve, 100)) } init() What happens when you remove the await of...