Class: ActiveSupport::Notifications::Fanout::Handle
- Defined in:
 - lib/active_support/notifications/fanout.rb
 
Overview
A Handle is used to record the start and finish time of event.
Both #start and #finish must each be called exactly once.
Where possible, it’s best to use the block form: ActiveSupport::Notifications.instrument. Handle is a low-level API intended for cases where the block form can’t be used.
handle = ActiveSupport::Notifications.instrumenter.build_handle("my.event", {})
begin
  handle.start
  # work to be instrumented
ensure
  handle.finish
end
  Instance Method Summary collapse
- #finish ⇒ Object
 - 
  
    
      #finish_with_values(name, id, payload)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
:nodoc:.
 - 
  
    
      #initialize(notifier, name, id, groups, payload)  ⇒ Handle 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
:nodoc:.
 - #start ⇒ Object
 
Constructor Details
#initialize(notifier, name, id, groups, payload) ⇒ Handle
:nodoc:
      233 234 235 236 237 238 239  | 
    
      # File 'lib/active_support/notifications/fanout.rb', line 233 def initialize(notifier, name, id, groups, payload) # :nodoc: @name = name @id = id @payload = payload @groups = groups @state = :initialized end  | 
  
Instance Method Details
#finish ⇒ Object
      250 251 252  | 
    
      # File 'lib/active_support/notifications/fanout.rb', line 250 def finish finish_with_values(@name, @id, @payload) end  | 
  
#finish_with_values(name, id, payload) ⇒ Object
:nodoc:
      254 255 256 257 258 259 260 261  | 
    
      # File 'lib/active_support/notifications/fanout.rb', line 254 def finish_with_values(name, id, payload) # :nodoc: ensure_state! :started @state = :finished iterate_guarding_exceptions(@groups) do |group| group.finish(name, id, payload) end end  | 
  
#start ⇒ Object
      241 242 243 244 245 246 247 248  | 
    
      # File 'lib/active_support/notifications/fanout.rb', line 241 def start ensure_state! :initialized @state = :started iterate_guarding_exceptions(@groups) do |group| group.start(@name, @id, @payload) end end  |