Class: RuboCop::Cop::AnyCable::StreamFrom
- Inherits:
-
Cop
- Object
- Cop
- RuboCop::Cop::AnyCable::StreamFrom
- Defined in:
- lib/anycable/rails/compatibility/rubocop/cops/anycable/stream_from.rb
Overview
Checks for #stream_from calls with custom callbacks or coders.
# good
class MyChannel < ApplicationCable::Channel
def follow
stream_from "all"
end
end
Instance Method Summary collapse
Instance Method Details
#on_block(node) ⇒ Object
56 57 58 |
# File 'lib/anycable/rails/compatibility/rubocop/cops/anycable/stream_from.rb', line 56 def on_block(node) add_callback_offense(node) if stream_from_with_block?(node) end |
#on_send(node) ⇒ Object
60 61 62 63 64 65 66 67 68 |
# File 'lib/anycable/rails/compatibility/rubocop/cops/anycable/stream_from.rb', line 60 def on_send(node) if stream_from_with_callback?(node) add_callback_offense(node) return end args = args_of_stream_from(node) find_coders(args) { |coder| add_custom_coder_offense(coder) } end |