Class: ActionCable::Channel::ConnectionStub
Relationships & Source Files | |
Inherits: | Object |
Defined in: | actioncable/lib/action_cable/channel/test_case.rb |
Class Method Summary
- .new(identifiers = {}) ⇒ ConnectionStub constructor
Instance Attribute Summary
- #config readonly
- #identifiers readonly
- #logger readonly
- #pubsub readonly
- #server readonly
- #subscriptions readonly
- #transmissions readonly
Instance Method Summary
Constructor Details
.new(identifiers = {}) ⇒ ConnectionStub
# 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
Instance Attribute Details
#config (readonly)
[ GitHub ]#identifiers (readonly)
[ GitHub ]# File 'actioncable/lib/action_cable/channel/test_case.rb', line 51
attr_reader :server, :transmissions, :identifiers, :subscriptions, :logger
#logger (readonly)
[ GitHub ]# File 'actioncable/lib/action_cable/channel/test_case.rb', line 51
attr_reader :server, :transmissions, :identifiers, :subscriptions, :logger
#pubsub (readonly)
[ GitHub ]#server (readonly)
[ GitHub ]# File 'actioncable/lib/action_cable/channel/test_case.rb', line 51
attr_reader :server, :transmissions, :identifiers, :subscriptions, :logger
#subscriptions (readonly)
[ GitHub ]# File 'actioncable/lib/action_cable/channel/test_case.rb', line 51
attr_reader :server, :transmissions, :identifiers, :subscriptions, :logger
#transmissions (readonly)
[ GitHub ]# File 'actioncable/lib/action_cable/channel/test_case.rb', line 51
attr_reader :server, :transmissions, :identifiers, :subscriptions, :logger
Instance Method Details
#connection_gid(ids) (private)
[ GitHub ]# File 'actioncable/lib/action_cable/channel/test_case.rb', line 77
def connection_gid(ids) ids.map do |o| if o.respond_to?(:to_gid_param) o.to_gid_param else o.to_s end end.sort.join(":") end
#connection_identifier
[ GitHub ]# 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)
[ GitHub ]# File 'actioncable/lib/action_cable/channel/test_case.rb', line 68
def transmit( ) transmissions << .with_indifferent_access end