liveBook · Manning

Per-object change

As explained in The Well-Grounded Rubyist, Fourth Edition

Per-object change is adding or altering behavior for one individual object without changing the behavior of other instances of its class.

Per-object change adds or alters behavior for one individual object without changing how other instances of its class behave. section 13.2.1

Ruby core functionality is approached through four techniques: additive change, pass-through change, per-object change, and refinements. Refinements provide module-scoped changes, while per-object change is identified as a separate technique. section 13.2.1

Use per-object change when the customization should remain local to a particular object.

  • Keep the behavior of other instances unchanged. section 13.2.1
  • Compare it with additive change, pass-through change, and refinements when selecting a way to modify core behavior. section 13.2.1

How The Well-Grounded Rubyist, Fourth Edition covers it

How deep it goes
Defines the scope distinction and names related techniques, but does not explain implementation mechanics or provide a per-object worked example.
What it assumes
Assumes familiarity with Ruby objects and core functionality while comparing several ways to customize behavior.
How it connects
Connects per-object change with additive change, pass-through change, refinements, and Ruby core functionality.

This explainer was generated by Manning's knowledge graph from the text of The Well-Grounded Rubyist, Fourth Edition. The section links point to the parts of the book it draws on.