Module: Pistachio

Defined in:
lib/pistachio.rb,
lib/pistachio/middleware.rb

Defined Under Namespace

Classes: Middleware

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'lib/pistachio.rb', line 7

def path
  @path
end

.timeoutObject (readonly)

Returns the value of attribute timeout.



7
8
9
# File 'lib/pistachio.rb', line 7

def timeout
  @timeout
end

Class Method Details

.[](endpoint) ⇒ Object

Retrieve a Pistachio endpoint for the default connection



29
30
31
# File 'lib/pistachio.rb', line 29

def [](endpoint)
  Stash::List[endpoint]
end

.setup(connection_name, options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/pistachio.rb', line 9

def setup(connection_name, options = {})
  unless connection_name == :default
    raise ArgumentError, "only the default connection is supported, sorry"
  end

  opts = {
    :path    => '/push_messages',
    :adapter => 'redis',
    :host    => 'localhost',
    :timeout => 30
  }.merge(options)

  @path    = opts[:path]
  @timeout = opts[:timeout]

  Stash.setup :default, opts
  true
end