liveBook · Manning

Method chaining

Method chaining is a programming technique in which successive method calls use the object or value returned by the preceding call.

How 3 Manning books explain it

The Well-Grounded Rubyist, Fourth Edition

A method chain is a sequence in which the result of one method call becomes the receiver of a subsequent method call.

How it is used
Organizes Ruby transformations so each method’s result becomes the next method’s receiver.
How deep it goes
Works through return values, collection allocation, and failure when a mutating method returns nil; stops short of exhaustive API guidance.
Examples
Uses animal-name filtering and uppercasing, string reversal, and a failed gsub! chain to make successive receivers visible.
What you can do after
Practice/perform Ruby method chaining while checking intermediate types, return values, allocation, and possible nil results.

Read how The Well-Grounded Rubyist, Fourth Edition explains method chaining →

.NET in Action, Second Edition

Method chaining is a programming style in which successive method calls are applied to the object returned by the preceding call.

How it is used
Uses fluent calls to process successful and failed command-line parsing without separate intermediate statements.
How deep it goes
Explains return-value flow and conditional execution, with a focused C# implementation rather than general chaining internals.
Examples
Demonstrates ParseArguments followed by WithParsed and WithNotParsed in a console application.
What you can do after
Apply it via CommandLineParser to route successful and unsuccessful parsing results through concise callback chains.

Read how .NET in Action, Second Edition explains method chaining →

D3.js in Action, Third Edition

Method chaining is a programming technique in which successive method calls operate on and return an updated object through a linked call sequence.

How it is used
Uses successive calls to build concise, readable D3 selections and DOM content.
How deep it goes
Explains ordered object updates with a car analogy and demonstrates complete D3 selection code without covering broader API internals.
Examples
Demonstrates a car assembly line and a D3 sequence that creates, labels, nests, and styles paragraph and span elements.
What you can do after
Apply it via D3 to create and style nested DOM elements through readable call sequences.

Read how D3.js in Action, Third Edition explains method chaining →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.