Module: PusherFake

Defined in:
lib/pusher-fake.rb,
lib/pusher-fake/server.rb,
lib/pusher-fake/channel.rb,
lib/pusher-fake/webhook.rb,
lib/pusher-fake/connection.rb,
lib/pusher-fake/configuration.rb,
lib/pusher-fake/channel/public.rb,
lib/pusher-fake/channel/private.rb,
lib/pusher-fake/channel/presence.rb,
lib/pusher-fake/server/application.rb

Defined Under Namespace

Modules: Channel, Server Classes: Configuration, Connection, Webhook

Constant Summary collapse

VERSION =

The current version string.

"1.6.0"

Class Method Summary collapse

Class Method Details

.configurationConfiguration

Returns Current configuration.

Returns:



30
31
32
# File 'lib/pusher-fake.rb', line 30

def self.configuration
  @configuration ||= Configuration.new
end

.configure {|Configuration| ... } ⇒ Object

Call this method to modify the defaults.

Examples:

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

Yields:



25
26
27
# File 'lib/pusher-fake.rb', line 25

def self.configure
  yield configuration
end

.javascript(options = {}) ⇒ String

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

Parameters:

  • options (Hash) (defaults to: {})

    Custom options for Pusher client.

Returns:

  • (String)

    JavaScript overriding the Pusher client host and port.



38
39
40
41
42
43
44
45
# File 'lib/pusher-fake.rb', line 38

def self.javascript(options = {})
  arguments = [
    configuration.key,
    configuration.to_options(options)
  ].map(&:to_json).join(",")

  "new Pusher(#{arguments})"
end

.log(message) ⇒ Object



47
48
49
50
51
# File 'lib/pusher-fake.rb', line 47

def self.log(message)
  if configuration.verbose
    configuration.logger << "#{message}\n"
  end
end