sethyates-content_manager 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/content_manager.gemspec +1 -1
- data/lib/content_item.rb +8 -0
- data/lib/rack/content_manager.rb +3 -3
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/content_manager.gemspec
CHANGED
data/lib/content_item.rb
CHANGED
@@ -63,6 +63,14 @@ class ContentItem
|
|
63
63
|
ContentItem.connection[url] = hash
|
64
64
|
end
|
65
65
|
|
66
|
+
def to_yaml
|
67
|
+
attributes.to_yaml
|
68
|
+
end
|
69
|
+
|
70
|
+
def to_json
|
71
|
+
attributes.to_json
|
72
|
+
end
|
73
|
+
|
66
74
|
def method_missing(name, *arguments)
|
67
75
|
if arguments.length > 0
|
68
76
|
attributes[name.to_s.chomp('=')] = arguments.first
|
data/lib/rack/content_manager.rb
CHANGED
@@ -6,12 +6,12 @@ module Rack
|
|
6
6
|
|
7
7
|
def call(env)
|
8
8
|
item = ContentItem.find_first_by_url(env["REQUEST_PATH"])
|
9
|
-
|
10
|
-
@app.call(env)
|
11
|
-
else
|
9
|
+
unless item.nil?
|
12
10
|
response = Rack::Response.new
|
13
11
|
response.write "Hi there"
|
14
12
|
response.finish
|
13
|
+
else
|
14
|
+
@app.call(env)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|