objectsframework 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/objectsframework/object_handler.rb +8 -3
- data/lib/objectsframework/server.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30d61999b7e0f96d7258ea7a09db0475b8332e37
|
4
|
+
data.tar.gz: c9e4114b40d67cf9b1ac9f18c1deb58dff94a882
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e47f0a245ebbe00360aded3834c55991dccba29ad5ecce554686c17c00a37e16084e592bda6ea9403ee96f8b79614c34cae42e21ec5e90691c0cf861df5c4f5f
|
7
|
+
data.tar.gz: 762c135d8f7aafc5cbb6f6ac571bfa1abcd8b96a7d5eda50650c44daa686559a32eeb2e37bfce8c4810bc404340c74727b98a5e12b66914c9180bad84156ab3b
|
@@ -1,12 +1,17 @@
|
|
1
1
|
module ObjectsFramework
|
2
2
|
class ObjectHandler
|
3
|
-
def self.run_methods(request,response)
|
3
|
+
def self.run_methods(request,response,context)
|
4
4
|
path = request.path
|
5
5
|
parts = path.split("/")
|
6
|
+
if(path == "/" && !context.config[:root].nil?)
|
7
|
+
klass = Object.const_get(context.config[:root]).new.set_instance_variables(request,response).send(request.request_method.downcase!+"_"+context.config[:index_method])
|
8
|
+
return
|
9
|
+
end
|
10
|
+
|
6
11
|
begin
|
7
12
|
klass = Object.const_get(parts[1].capitalize).new.set_instance_variables(request,response)
|
8
|
-
if(parts[3].nil?)
|
9
|
-
if(path[path.length-1] == "/")
|
13
|
+
if(parts[3].nil?)
|
14
|
+
if(path[path.length-1] == "/" || parts.length == 2)
|
10
15
|
klass.send(request.request_method.downcase!+"_index");
|
11
16
|
else
|
12
17
|
klass.send(request.request_method.downcase!+"_"+parts[2])
|
@@ -1,7 +1,9 @@
|
|
1
1
|
module ObjectsFramework
|
2
2
|
class Server
|
3
|
-
|
3
|
+
attr_accessor :config
|
4
4
|
|
5
|
+
def initialize(config = {})
|
6
|
+
@config = {:index_method => "index"}.merge(config)
|
5
7
|
end
|
6
8
|
|
7
9
|
def call(env)
|
@@ -12,7 +14,7 @@ module ObjectsFramework
|
|
12
14
|
response.length = 0
|
13
15
|
# Set text/html as Content-type by default
|
14
16
|
response.header["Content-type"] = "text/html"
|
15
|
-
ObjectsFramework::ObjectHandler.run_methods(request,response);
|
17
|
+
ObjectsFramework::ObjectHandler.run_methods(request,response,self);
|
16
18
|
response.finish
|
17
19
|
end
|
18
20
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: objectsframework
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bram Vandenbogaerde
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|