Skip to content
  • Sam Bostock's avatar
    f07af59a
    [ruby/prism] Dynamically register events to dispatch · f07af59a
    Sam Bostock authored
    Instead of requiring the consumer to provide a list of all events which
    they wish to handle, we can give them to option of dynamically detecting
    them, by scanning the listener's public methods.
    
    This approach is similar to that used by Minitest (scanning for `test_`
    methods) and Rails generators (running all public methods in the order
    they are defined).
    
    While this is slower than specifying a hard coded list, the penalty is
    only during registration. There is no change the the behaviour of
    dispatching the events.
    
    https://github.com/ruby/prism/commit/781ebed743
    f07af59a
    [ruby/prism] Dynamically register events to dispatch
    Sam Bostock authored
    Instead of requiring the consumer to provide a list of all events which
    they wish to handle, we can give them to option of dynamically detecting
    them, by scanning the listener's public methods.
    
    This approach is similar to that used by Minitest (scanning for `test_`
    methods) and Rails generators (running all public methods in the order
    they are defined).
    
    While this is slower than specifying a hard coded list, the penalty is
    only during registration. There is no change the the behaviour of
    dispatching the events.
    
    https://github.com/ruby/prism/commit/781ebed743
Loading