Class: SSD::Ext

Inherits:
Object
  • Object
show all
Defined in:
lib/mushin_ext_ssd.rb

Instance Method Summary collapse

Constructor Details

#initialize(app = nil, opts = {}, params = {}) ⇒ Ext

Returns a new instance of Ext.



10
11
12
13
14
# File 'lib/mushin_ext_ssd.rb', line 10

def initialize app=nil, opts={}, params={}
  @app  = app
  @opts   = opts
  @params   = params 
end

Instance Method Details

#call(env) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/mushin_ext_ssd.rb', line 15

def call env 
  env ||= Hash.new 
  # write inbound code
  @app.call(env)
  # write outbound code
  if @opts[:cqrs] == :cqrs_query then
  env[:query_results] = SSD.read(@opts[:path], @params[:id])
  else 
  SSD.write @opts[:path], env[:id], env
  end
end