hashtag_channel.rb 325 B

12345678910111213
  1. # frozen_string_literal: true
  2. class HashtagChannel < ApplicationCable::Channel
  3. def subscribed
  4. tag = params[:tag].downcase
  5. stream_from "timeline:hashtag:#{tag}", lambda { |encoded_message|
  6. status, message = hydrate_status(encoded_message)
  7. next if filter?(status)
  8. transmit message
  9. }
  10. end
  11. end