cachafla-yard-sinatra 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/yard/sinatra.rb +1 -1
- data/spec/example_extension.rb +35 -0
- metadata +4 -4
data/lib/yard/sinatra.rb
CHANGED
@@ -118,7 +118,7 @@ module YARD
|
|
118
118
|
class RouteHandler < Ruby::Legacy::Base
|
119
119
|
VERBS = %w[get head post put delete not_found]
|
120
120
|
include AbstractRouteHandler
|
121
|
-
handles /\A
|
121
|
+
handles /\A(.*\.){0,1}(get|post|put|delete|head|not_found)[\s\(].*/m
|
122
122
|
|
123
123
|
def http_verb
|
124
124
|
method_call_string = ''
|
data/spec/example_extension.rb
CHANGED
@@ -26,6 +26,41 @@ module Sinatra
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
+
# FORGET_ABOUT /login
|
30
|
+
forget '/login_me' do
|
31
|
+
if params[:user] == options.username && params[:pass] == options.password
|
32
|
+
session[:authorized] = true
|
33
|
+
redirect '/'
|
34
|
+
else
|
35
|
+
session[:authorized] = false
|
36
|
+
redirect '/login'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# PUT_ME /login
|
41
|
+
put_me '/login_me' do
|
42
|
+
if params[:user] == options.username && params[:pass] == options.password
|
43
|
+
session[:authorized] = true
|
44
|
+
redirect '/'
|
45
|
+
else
|
46
|
+
session[:authorized] = false
|
47
|
+
redirect '/login'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# POST_YOU /login
|
52
|
+
app.post_you '/login_me' do
|
53
|
+
if params[:user] == options.username && params[:pass] == options.password
|
54
|
+
session[:authorized] = true
|
55
|
+
redirect '/'
|
56
|
+
else
|
57
|
+
session[:authorized] = false
|
58
|
+
redirect '/login'
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
some_array.delete_if {|item| item.exclusive?}
|
63
|
+
|
29
64
|
# Error 404 Page Not Found
|
30
65
|
app.not_found '/test' do
|
31
66
|
haml :'404'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cachafla-yard-sinatra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 1
|
10
|
+
version: 0.6.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Konstantin Haase
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-02-
|
19
|
+
date: 2011-02-15 00:00:00 -08:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|