{
    "mode": "ri",
    "parameter": "ActiveSupport::Subscriber",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/ri/ActiveSupport%3A%3ASubscriber/json",
    "generated": "2026-07-28T13:45:29Z",
    "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": []
        }
    },
    "flags": [],
    "examples": [],
    "see_also": []
}