{
    "content": [
        {
            "type": "text",
            "text": "# ActiveSupport::Callbacks (ri)\n\n## Sections\n\n- **ActiveSupport::Callbacks**\n- **Extended by:**\n- **Constants:**\n- **Instance methods:**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "ActiveSupport::Callbacks",
        "section": "",
        "mode": "ri",
        "summary": null,
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "ActiveSupport::Callbacks",
                "lines": 1,
                "subsections": []
            },
            {
                "name": "Extended by:",
                "lines": 59,
                "subsections": []
            },
            {
                "name": "Constants:",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "Instance methods:",
                "lines": 2,
                "subsections": []
            }
        ],
        "sections": {
            "ActiveSupport::Callbacks": {
                "content": "------------------------------------------------------------------------",
                "subsections": []
            },
            "Extended by:": {
                "content": "(from /home/chedong/.local/share/rdoc)\nConcern\nActiveSupport::DescendantsTracker\n\n(from /home/chedong/.local/share/rdoc)\n------------------------------------------------------------------------\nCallbacks are code hooks that are run at key points in an object's life\ncycle. The typical use case is to have a base class define a set of\ncallbacks relevant to the other functionality it supplies, so that\nsubclasses can install callbacks that enhance or modify the base\nfunctionality without needing to override or redefine methods of the\nbase class.\n\nMixing in this module allows you to define the events in the object's\nlife cycle that will support callbacks (via\nClassMethods.definecallbacks), set the instance methods, procs, or\ncallback objects to be called (via ClassMethods.setcallback), and run\nthe installed callbacks at the appropriate times (via runcallbacks).\n\nBy default callbacks are halted by throwing :abort. See\nClassMethods.definecallbacks for details.\n\nThree kinds of callbacks are supported: before callbacks, run before a\ncertain event; after callbacks, run after the event; and around\ncallbacks, blocks that surround the event, triggering it when they\nyield. Callback code can be contained in instance methods, procs or\nlambdas, or callback objects that respond to certain predetermined\nmethods. See ClassMethods.setcallback for details.\n\nclass Record\ninclude ActiveSupport::Callbacks\ndefinecallbacks :save\n\ndef save\nruncallbacks :save do\nputs \"- save\"\nend\nend\nend\n\nclass PersonRecord < Record\nsetcallback :save, :before, :savingmessage\ndef savingmessage\nputs \"saving...\"\nend\n\nsetcallback :save, :after do |object|\nputs \"saved\"\nend\nend\n\nperson = PersonRecord.new\nperson.save\n\nOutput:\nsaving...\n- save\nsaved\n------------------------------------------------------------------------",
                "subsections": []
            },
            "Constants:": {
                "content": "CALLBACKFILTERTYPES:\n[not documented]\n\n",
                "subsections": []
            },
            "Instance methods:": {
                "content": "runcallbacks\n",
                "subsections": []
            }
        }
    }
}