Class: Serf::Middleware::ParcelFreezer

Inherits:
Object
  • Object
show all
Defined in:
lib/serf/middleware/parcel_freezer.rb

Overview

Middleware to add uuids to freeze the parcel.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, *args) ⇒ ParcelFreezer

Returns a new instance of ParcelFreezer.

Parameters:

  • app

    the app



17
18
19
20
21
# File 'lib/serf/middleware/parcel_freezer.rb', line 17

def initialize(app, *args)
  opts = Optser.extract_options! args
  @app = app
  @freezer = opts.get :freezer, IceNine
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



11
12
13
# File 'lib/serf/middleware/parcel_freezer.rb', line 11

def app
  @app
end

#freezerObject (readonly)

Returns the value of attribute freezer.



12
13
14
# File 'lib/serf/middleware/parcel_freezer.rb', line 12

def freezer
  @freezer
end

Instance Method Details

#call(parcel) ⇒ Object

Chains the call, but deep freezes the parcel.



25
26
27
28
# File 'lib/serf/middleware/parcel_freezer.rb', line 25

def call(parcel)
  freezer.deep_freeze parcel
  app.call parcel
end