Class: SimpleJSON

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_json.rb,
lib/simple_json_helpers.rb,
lib/simple_json_bootstrap.rb

Overview

///////////////////////////////////////////////////////////////////////////////////////

Author

lp ([email protected])

Copyright

2009 Louis-Philippe Perron - Released under the terms of the MIT license

:title:SimpleJSON

Defined Under Namespace

Modules: Body, Bootstrap, CrashProof, Request, Response

Class Method Summary collapse

Class Method Details

.add(opts = nil) ⇒ Object



20
21
22
# File 'lib/simple_json.rb', line 20

def self.add(opts=nil)
	lambda { |env| CrashProof.wrap { Bootstrap.config(opts); Response.generate( @@store.add( 		Request.parse( Body.get(env)))) }}
end

.bootstrap(opts) ⇒ Object



2
3
4
# File 'lib/simple_json_bootstrap.rb', line 2

def self.bootstrap(opts)
	Bootstrap.config(opts)
end

.delete(opts = nil) ⇒ Object



24
25
26
# File 'lib/simple_json.rb', line 24

def self.delete(opts=nil)
	lambda { |env| CrashProof.wrap { Bootstrap.config(opts); Response.generate( @@store.delete(	Request.parse( Body.get(env)))) }}
end

.echo(opts = nil) ⇒ Object



12
13
14
# File 'lib/simple_json.rb', line 12

def self.echo(opts=nil)
	lambda { |env| CrashProof.wrap { Bootstrap.config(opts); Response.generate( Request.parse( Body.get(env))) }}
end

.get(opts = nil) ⇒ Object



28
29
30
# File 'lib/simple_json.rb', line 28

def self.get(opts=nil)
	lambda { |env| CrashProof.wrap { Bootstrap.config(opts); Response.generate( @@store.get( 		Request.parse( Body.get(env)))) }}
end

.query(opts = nil) ⇒ Object



32
33
34
# File 'lib/simple_json.rb', line 32

def self.query(opts=nil)
	lambda { |env| CrashProof.wrap { Bootstrap.config(opts); Response.generate( @@store.query( 	Request.parse( Body.get(env)))) }}
end

.rack_mock(m, data, opts = nil) ⇒ Object



36
37
38
# File 'lib/simple_json.rb', line 36

def self.rack_mock(m,data,opts=nil)
	CrashProof.wrap { Bootstrap.config(opts); Response.generate( @@store.send( m, Request.parse( data))) }
end

.set(opts = nil) ⇒ Object



16
17
18
# File 'lib/simple_json.rb', line 16

def self.set(opts=nil)
	lambda { |env| CrashProof.wrap { Bootstrap.config(opts); Response.generate( @@store.set( 		Request.parse( Body.get(env)))) }}
end