跳至内容 跳至搜索
方法
C
N
T

属性

[R] identifiers
[R] logger
[R] server
[R] subscriptions
[R] transmissions

类公共方法

new(identifiers = {})

# File actioncable/lib/action_cable/channel/test_case.rb, line 55
def initialize(identifiers = {})
  @server = ActionCable.server
  @transmissions = []

  identifiers.each do |identifier, val|
    define_singleton_method(identifier) { val }
  end

  @subscriptions = ActionCable::Connection::Subscriptions.new(self)
  @identifiers = identifiers.keys
  @logger = ActiveSupport::TaggedLogging.new ActiveSupport::Logger.new(StringIO.new)
end

实例公共方法

connection_identifier()

# File actioncable/lib/action_cable/channel/test_case.rb, line 72
def connection_identifier
  @connection_identifier ||= connection_gid(identifiers.filter_map { |id| send(id.to_sym) if id })
end

transmit(cable_message)

# File actioncable/lib/action_cable/channel/test_case.rb, line 68
def transmit(cable_message)
  transmissions << cable_message.with_indifferent_access
end