{
    "content": [
        {
            "type": "text",
            "text": "# ActiveSupport::Subscriber (ri)\n\n## Sections\n\n- **ActiveSupport::Subscriber < Object**\n- **Class methods:**\n- **Instance methods:**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "ActiveSupport::Subscriber",
        "section": "",
        "mode": "ri",
        "summary": null,
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "ActiveSupport::Subscriber < Object",
                "lines": 27,
                "subsections": []
            },
            {
                "name": "Class methods:",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "Instance methods:",
                "lines": 3,
                "subsections": []
            }
        ],
        "sections": {
            "ActiveSupport::Subscriber < Object": {
                "content": "(from /home/chedong/.local/share/rdoc)\n------------------------------------------------------------------------\nActiveSupport::Subscriber is an object set to consume\nActiveSupport::Notifications. The subscriber dispatches notifications to\na registered object based on its given namespace.\n\nAn example would be an Active Record subscriber responsible for\ncollecting statistics about queries:\n\nmodule ActiveRecord\nclass StatsSubscriber < ActiveSupport::Subscriber\nattachto :activerecord\n\ndef sql(event)\nStatsd.timing(\"sql.#{event.payload[:name]}\", event.duration)\nend\nend\nend\n\nAfter configured, whenever a \"sql.activerecord\" notification is\npublished, it will properly dispatch the event\n(ActiveSupport::Notifications::Event) to the sql method.\n\nWe can detach a subscriber as well:\n\nActiveRecord::StatsSubscriber.detachfrom(:activerecord)\n------------------------------------------------------------------------",
                "subsections": []
            },
            "Class methods:": {
                "content": "addeventsubscriber\nattachto\ndetachfrom\nmethodadded\nnew\nremoveeventsubscriber\nsubscribers\n",
                "subsections": []
            },
            "Instance methods:": {
                "content": "finish\nstart\n",
                "subsections": []
            }
        }
    }
}