annotation 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES.txt +1 -1
- data/README.txt +1 -1
- data/annotation.gemspec +2 -2
- data/lib/annotation.rb +18 -14
- data/test/annotation_test.rb +1 -1
- data/test/examples_test.rb +1 -1
- metadata +3 -3
data/CHANGES.txt
CHANGED
data/README.txt
CHANGED
data/annotation.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
|
3
3
|
###
|
4
|
-
### $Release: 0.1.
|
4
|
+
### $Release: 0.1.2 $
|
5
5
|
### $Copyright: copyright(c) 2010 kuwata-lab.com all rights reserved $
|
6
6
|
### $License: MIT-License $
|
7
7
|
###
|
@@ -15,7 +15,7 @@ spec = Gem::Specification.new do |s|
|
|
15
15
|
s.author = "makoto kuwata"
|
16
16
|
s.email = "kwa(at)kuwata-lab.com"
|
17
17
|
s.rubyforge_project = 'annotation'
|
18
|
-
s.version = "0.1.
|
18
|
+
s.version = "0.1.2"
|
19
19
|
s.platform = Gem::Platform::RUBY
|
20
20
|
s.homepage = "http://github.com/kwatch/annotation"
|
21
21
|
s.summary = "annotation library similar to Java or Python"
|
data/lib/annotation.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
###
|
4
|
-
### $Release: 0.1.
|
4
|
+
### $Release: 0.1.2 $
|
5
5
|
### $Copyright: copyright(c) 2010 kuwata-lab.com all rights reserved $
|
6
6
|
### $License: MIT-License $
|
7
7
|
###
|
@@ -14,32 +14,33 @@
|
|
14
14
|
### require 'annotation'
|
15
15
|
###
|
16
16
|
###
|
17
|
-
###
|
17
|
+
### module ControllerAnnotations
|
18
18
|
### extend Annotation
|
19
19
|
###
|
20
|
-
### def
|
21
|
-
### (@__routes ||= []) << [path, :GET,
|
20
|
+
### def GET(method_name, path)
|
21
|
+
### (@__routes ||= []) << [path, :GET, method_name]
|
22
22
|
### end
|
23
23
|
###
|
24
|
-
### def
|
25
|
-
### (@__routes ||= []) << [path, :POST,
|
24
|
+
### def POST(method_name, path)
|
25
|
+
### (@__routes ||= []) << [path, :POST, method_name]
|
26
26
|
### end
|
27
27
|
###
|
28
|
-
### def
|
29
|
-
### alias_method "__orig_#{
|
30
|
-
### s = "def #{
|
28
|
+
### def login_required(method_name)
|
29
|
+
### alias_method "__orig_#{method_name}", method_name
|
30
|
+
### s = "def #{method_name}(*args)
|
31
31
|
### raise '302 Found' unless @current_user
|
32
|
-
### __orig_#{
|
32
|
+
### __orig_#{method_name}(*args)
|
33
33
|
### end"
|
34
34
|
### self.class_eval s # not 'eval(s)'
|
35
35
|
### end
|
36
36
|
###
|
37
|
-
### annotation :GET, :POST, :login_required
|
37
|
+
### annotation :GET, :POST, :login_required # !!!!!!
|
38
38
|
###
|
39
39
|
### end
|
40
40
|
###
|
41
41
|
###
|
42
|
-
### class
|
42
|
+
### class Controller
|
43
|
+
### extend ControllerAnnotations
|
43
44
|
###
|
44
45
|
### GET('/')
|
45
46
|
### def index
|
@@ -63,11 +64,14 @@
|
|
63
64
|
### end
|
64
65
|
###
|
65
66
|
###
|
66
|
-
### p
|
67
|
+
### p Controller.new.update(123) #=> 302 Found (RuntimeError)
|
68
|
+
###
|
69
|
+
###
|
70
|
+
### See README.txt for more examples.
|
67
71
|
###
|
68
72
|
module Annotation
|
69
73
|
|
70
|
-
VERSION = "$Release: 0.1.
|
74
|
+
VERSION = "$Release: 0.1.2 $".split(' ')[1]
|
71
75
|
|
72
76
|
def annotation(*names)
|
73
77
|
self.class_eval do
|
data/test/annotation_test.rb
CHANGED
data/test/examples_test.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: annotation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- makoto kuwata
|