module PusherFake

A Pusher fake.

:nocov:

Constants

VERSION

The current version string.

Public Class Methods

configuration() click to toggle source

@return [Configuration] Current configuration.

# File lib/pusher-fake.rb, line 33
def self.configuration
  @configuration ||= Configuration.new
end
configure() { |configuration| ... } click to toggle source

Call this method to modify the defaults.

@example

PusherFake.configure do |configuration|
  configuration.port = 443
end

@yield [Configuration] The current configuration.

# File lib/pusher-fake.rb, line 28
def self.configure
  yield configuration
end
javascript(options = {}) click to toggle source

Convenience method for the JS to override the Pusher client host and port.

@param [Hash] options Custom options for Pusher client. @return [String] JavaScript overriding the Pusher client host and port.

# File lib/pusher-fake.rb, line 41
def self.javascript(options = {})
  arguments = [
    configuration.key,
    configuration.to_options(options)
  ].map(&:to_json).join(",")

  "new Pusher(#{arguments})"
end
log(message) click to toggle source
# File lib/pusher-fake.rb, line 50
def self.log(message)
  configuration.logger << "#{message}\n" if configuration.verbose
end