anise 0.7.0 → 0.8.0

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.
metadata CHANGED
@@ -1,125 +1,143 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
5
- prerelease:
4
+ version: 0.8.0
6
5
  platform: ruby
7
6
  authors:
8
- - trans
9
- autorequire:
7
+ - Trans
10
8
  bindir: bin
11
9
  cert_chain: []
12
- date: 2012-05-01 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
13
11
  dependencies:
14
12
  - !ruby/object:Gem::Dependency
15
- name: qed
16
- requirement: &23336160 !ruby/object:Gem::Requirement
17
- none: false
13
+ name: rake
14
+ requirement: !ruby/object:Gem::Requirement
18
15
  requirements:
19
- - - ! '>='
16
+ - - ">="
20
17
  - !ruby/object:Gem::Version
21
- version: '0'
18
+ version: '13'
22
19
  type: :development
23
20
  prerelease: false
24
- version_requirements: *23336160
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '13'
25
26
  - !ruby/object:Gem::Dependency
26
- name: ae
27
- requirement: &23332340 !ruby/object:Gem::Requirement
28
- none: false
27
+ name: rubytest
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.11.1
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 0.11.1
40
+ - !ruby/object:Gem::Dependency
41
+ name: spectrum
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0.2'
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
29
50
  requirements:
30
- - - ! '>='
51
+ - - ">="
31
52
  - !ruby/object:Gem::Version
32
- version: '0'
53
+ version: '0.2'
54
+ - !ruby/object:Gem::Dependency
55
+ name: assay
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 0.5.1
33
61
  type: :development
34
62
  prerelease: false
35
- version_requirements: *23332340
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: 0.5.1
36
68
  - !ruby/object:Gem::Dependency
37
- name: citron
38
- requirement: &23316360 !ruby/object:Gem::Requirement
39
- none: false
69
+ name: qed
70
+ requirement: !ruby/object:Gem::Requirement
40
71
  requirements:
41
- - - ! '>='
72
+ - - ">="
42
73
  - !ruby/object:Gem::Version
43
- version: '0'
74
+ version: '3.0'
44
75
  type: :development
45
76
  prerelease: false
46
- version_requirements: *23316360
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '3.0'
47
82
  - !ruby/object:Gem::Dependency
48
- name: detroit
49
- requirement: &23300140 !ruby/object:Gem::Requirement
50
- none: false
83
+ name: ae
84
+ requirement: !ruby/object:Gem::Requirement
51
85
  requirements:
52
- - - ! '>='
86
+ - - ">="
53
87
  - !ruby/object:Gem::Version
54
- version: '0'
88
+ version: '1.9'
55
89
  type: :development
56
90
  prerelease: false
57
- version_requirements: *23300140
58
- description: Anise is an annotations systems for the Ruby programming lanaguage.
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '1.9'
96
+ description: Anise is an annotations system for the Ruby programming language. Annotations
97
+ are data attached at runtime to the methods, attributes and other parts of a class
98
+ or module.
59
99
  email:
60
100
  - transfire@gmail.com
61
101
  executables: []
62
102
  extensions: []
63
- extra_rdoc_files:
64
- - LICENSE.txt
103
+ extra_rdoc_files: []
104
+ files:
65
105
  - HISTORY.md
106
+ - LICENSE.txt
66
107
  - README.md
67
- - DEMO.md
68
- files:
69
- - .ruby
70
- - .yardopts
71
- - demo/01_annotations.md
72
- - demo/03_attributes.md
73
- - demo/04_methods.md
74
- - demo/05_variables.md
75
- - demo/applique/ae.rb
76
- - demo/applique/anise.rb
77
- - demo/toplevel/01_annotations.md
78
- - demo/toplevel/03_attributes.md
79
- - lib/anise/annotations/store.rb
108
+ - lib/anise.rb
80
109
  - lib/anise/annotations.rb
110
+ - lib/anise/annotations/store.rb
111
+ - lib/anise/annotative.rb
81
112
  - lib/anise/annotative/attributes.rb
82
113
  - lib/anise/annotative/methods.rb
83
114
  - lib/anise/annotative/variables.rb
84
- - lib/anise/annotative.rb
85
115
  - lib/anise/core_ext.rb
86
116
  - lib/anise/universal.rb
87
117
  - lib/anise/version.rb
88
- - lib/anise.rb
89
- - lib/anise.yml
90
- - test/case_annotations.rb
91
- - test/case_attributes.rb
92
- - test/case_combined_usage.rb
93
- - test/case_methods.rb
94
- - test/case_variables.rb
95
- - test/helper.rb
96
- - HISTORY.md
97
- - README.md
98
- - DEMO.md
99
- - LICENSE.txt
100
- homepage: http://rubyworks.githuib.com/anise
118
+ homepage: https://github.com/rubyworks/anise
101
119
  licenses:
102
120
  - BSD-2-Clause
103
- post_install_message:
121
+ metadata:
122
+ source_code_uri: https://github.com/rubyworks/anise
123
+ bug_tracker_uri: https://github.com/rubyworks/anise/issues
124
+ changelog_uri: https://github.com/rubyworks/anise/blob/master/HISTORY.md
125
+ documentation_uri: https://rubydoc.info/gems/anise
104
126
  rdoc_options: []
105
127
  require_paths:
106
128
  - lib
107
129
  required_ruby_version: !ruby/object:Gem::Requirement
108
- none: false
109
130
  requirements:
110
- - - ! '>='
131
+ - - ">="
111
132
  - !ruby/object:Gem::Version
112
- version: '0'
133
+ version: '3.1'
113
134
  required_rubygems_version: !ruby/object:Gem::Requirement
114
- none: false
115
135
  requirements:
116
- - - ! '>='
136
+ - - ">="
117
137
  - !ruby/object:Gem::Version
118
138
  version: '0'
119
139
  requirements: []
120
- rubyforge_project:
121
- rubygems_version: 1.8.11
122
- signing_key:
123
- specification_version: 3
124
- summary: Dynamic Annotation System
140
+ rubygems_version: 3.6.9
141
+ specification_version: 4
142
+ summary: Dynamic annotations for Ruby
125
143
  test_files: []
data/.ruby DELETED
@@ -1,62 +0,0 @@
1
- ---
2
- source:
3
- - meta
4
- authors:
5
- - name: trans
6
- email: transfire@gmail.com
7
- copyrights:
8
- - holder: Rubyworks
9
- year: '2008'
10
- license: BSD-2-Clause
11
- requirements:
12
- - name: qed
13
- groups:
14
- - test
15
- development: true
16
- - name: ae
17
- groups:
18
- - test
19
- development: true
20
- - name: citron
21
- groups:
22
- - test
23
- development: true
24
- - name: detroit
25
- groups:
26
- - build
27
- development: true
28
- dependencies: []
29
- alternatives: []
30
- conflicts: []
31
- repositories:
32
- - uri: http://github.com/rubyworks/anise.git
33
- scm: git
34
- name: public
35
- resources:
36
- - uri: http://rubyworks.githuib.com/anise
37
- name: home
38
- type: home
39
- - uri: http://github.com/rubyworks/anise
40
- name: code
41
- type: code
42
- - uri: http://github.com/rubyworks/anise/issues
43
- name: bugs
44
- type: bugs
45
- - uri: http://chat.us.freenode.net/rubyworks
46
- name: chat
47
- type: chat
48
- - uri: http://groups.google.com/groups/rubyworks-mailinglist
49
- name: mail
50
- type: mail
51
- extra: {}
52
- load_path:
53
- - lib
54
- revision: 0
55
- created: '2008-02-21'
56
- summary: Dynamic Annotation System
57
- title: Anise
58
- version: 0.7.0
59
- name: anise
60
- description: Anise is an annotations systems for the Ruby programming lanaguage.
61
- organization: Rubyworks
62
- date: '2012-04-20'
data/.yardopts DELETED
@@ -1,7 +0,0 @@
1
- --title "Anise"
2
- --output-dir doc
3
- --private
4
- --protected
5
- lib/
6
- -
7
- [A-Z][A-Z]*.*
data/DEMO.md DELETED
@@ -1,242 +0,0 @@
1
- # Annotations
2
-
3
- ## Creating and Reading Annotations
4
-
5
- Load the Anise library.
6
-
7
- require 'anise'
8
-
9
- Given an example class X we can apply annotations to it using the #ann method.
10
-
11
- class X
12
- extend Anise::Annotations
13
-
14
- ann :x1, :a=>1
15
- ann :x1, :b=>2
16
- end
17
-
18
- We can then use #ann to lookup the set annotations.
19
-
20
- X.ann(:x1,:a).should == 1
21
-
22
- The #ann method is a public interface, so we can define annotation externally as well.
23
-
24
- X.ann :x1, :a => 2
25
- X.ann(:x1, :a).should == 2
26
-
27
- ## Annotation Added Callback
28
-
29
- Given a sample class Y, we can use a standard callback method #annotation_added().
30
-
31
- class Y
32
- extend Anise::Annotations
33
-
34
- class << self
35
- attr :last_callback
36
-
37
- def annotation_added(ref, ns)
38
- @last_callback = [ns, ref, ann(ref/ns)]
39
- end
40
- end
41
- end
42
-
43
- Now if we add an annotation, we will see the callback catches it.
44
-
45
- Y.ann :x1, :a=>1
46
- Y.last_callback.should == [:ann, :x1, {:a => 1}]
47
-
48
- We will do it again to be sure.
49
-
50
- Y.ann :x1, :b=>2
51
- Y.last_callback.should == [:ann, :x1, {:a => 1, :b => 2}]
52
-
53
- ## Using Callbacks for Attribute Defaults
54
-
55
- class ::Module
56
- def annotation_added(key, ns)
57
- return unless ns == :ann
58
- base = self
59
- if value = ann(key, :default)
60
- define_method(key) do
61
- instance_variable_set("@#{key}", value) unless instance_variable_defined?("@#{key}")
62
- base.module_eval{ attr key }
63
- instance_variable_get("@#{key}")
64
- end
65
- end
66
- end
67
- end
68
-
69
- Try it out.
70
-
71
- class Z
72
- extend Anise::Annotations
73
-
74
- attr :a
75
- ann :a, :default => 10
76
- end
77
-
78
- z = Z.new
79
- z.a.should == 10
80
- z.a.should == 10
81
-
82
-
83
- # Annotative Attributes
84
-
85
- Create a class that uses the `Annotative::Attributes` mixin.
86
-
87
- class X
88
- extend Anise::Annotative::Attributes
89
-
90
- attr :a, :count => 1
91
- end
92
-
93
- Then we can see tht the attribute method `:a` has an annotation entry.
94
-
95
- X.ann(:a, :count) #=> 1
96
-
97
-
98
- # Method Annotations
99
-
100
- Create a class that uses the `Annotative::Methods` mixin.
101
-
102
- class X
103
- extend Anise::Annotative::Methods
104
-
105
- def self.doc(string)
106
- method_annotation(:doc=>string.to_s)
107
- end
108
-
109
- doc "See what I mean?"
110
-
111
- def see
112
- puts "Yes, I see!"
113
- end
114
- end
115
-
116
- See that it is set.
117
-
118
- X.ann(:see, :doc) #=> "See what I mean?"
119
-
120
- Method Annotators can override the standard annotation procedure
121
- with a custom procedure. In such case no annotations will actually
122
- be created unless the `#ann` is called in the procedure.
123
-
124
- class Y
125
- extend Anise::Annotative::Methods
126
-
127
- def self.list
128
- @list ||= []
129
- end
130
-
131
- def self.doc(string)
132
- method_annotation do |method|
133
- list << [method, string]
134
- end
135
- end
136
-
137
- doc "See here!"
138
-
139
- def see
140
- puts "Yes, I see!"
141
- end
142
- end
143
-
144
- See that it is set.
145
-
146
- Y.list #=> [[:see, "See here!"]]
147
-
148
-
149
- # Variable Annotations
150
-
151
- Create a class that uses the `Annotative::Variables` mixin.
152
-
153
- class X
154
- extend Anise::Annotative::Variables
155
-
156
- variable_annotator :@doc
157
-
158
- @doc = "See what I mean?"
159
-
160
- def see
161
- puts "Yes, I see!"
162
- end
163
- end
164
-
165
- See that it is set.
166
-
167
- X.ann(:see, :@doc).should == "See what I mean?"
168
-
169
- Variable annotations can override the standard annotation procedure with a
170
- custom procedure.
171
-
172
- class Y
173
- extend Anise::Annotative::Variables
174
-
175
- def self.list
176
- @list ||= []
177
- end
178
-
179
- variable_annotator :@doc do |method, value|
180
- list << [method, value]
181
- end
182
-
183
- @doc = "See here!"
184
-
185
- def see
186
- puts "Yes, I see!"
187
- end
188
- end
189
-
190
- See that it is set.
191
-
192
- Y.list #=> [[:see, "See here!"]]
193
-
194
-
195
- = TOPLEVEL Annotations
196
-
197
- Extending Object with `Annotations` should make them available to all classes.
198
-
199
- class ::Object
200
- extend Anise::Annotations
201
- end
202
-
203
- Given a example class X we can apply annotations to it using the #ann method.
204
-
205
- class X
206
- ann :x1, :a=>1
207
- ann :x1, :b=>2
208
- end
209
-
210
- We can then use #ann to lookup the set annotations.
211
-
212
- X.ann(:x1,:a).should == 1
213
-
214
- The #ann method is a public interface, so we can define annotation externally as well.
215
-
216
- X.ann :x1, :a => 2
217
- X.ann(:x1, :a).should == 2
218
-
219
- Alternatively the `Annotations` module could be included into the `Module` class.
220
-
221
-
222
- = TOPLEVEL Annotated Attributes
223
-
224
- Including `AnnotatedAttributes` at the toplevel, i.e. Object, will make
225
- annotated attributes univerally available.
226
-
227
- class ::Object
228
- extend Anise::Annotative::Attributes
229
- end
230
-
231
- Create a class that uses it.
232
-
233
- class X
234
- attr :a, :count=>1
235
- end
236
-
237
- X.ann(:a, :count) #=> 1
238
-
239
- Alternatively the `Annotative::Attributes` module could be included into
240
- the `Module` class.
241
-
242
-
@@ -1,81 +0,0 @@
1
- # Annotations
2
-
3
- ## Creating and Reading Annotations
4
-
5
- Load the Anise library.
6
-
7
- require 'anise'
8
-
9
- Given an example class X we can apply annotations to it using the #ann method.
10
-
11
- class X
12
- extend Anise::Annotations
13
-
14
- ann :x1, :a=>1
15
- ann :x1, :b=>2
16
- end
17
-
18
- We can then use #ann to lookup the set annotations.
19
-
20
- X.ann(:x1,:a).should == 1
21
-
22
- The #ann method is a public interface, so we can define annotation externally as well.
23
-
24
- X.ann :x1, :a => 2
25
- X.ann(:x1, :a).should == 2
26
-
27
- ## Annotation Added Callback
28
-
29
- Given a sample class Y, we can use a standard callback method #annotation_added().
30
-
31
- class Y
32
- extend Anise::Annotations
33
-
34
- class << self
35
- attr :last_callback
36
-
37
- def annotation_added(ref, ns)
38
- @last_callback = [ns, ref, ann(ref/ns)]
39
- end
40
- end
41
- end
42
-
43
- Now if we add an annotation, we will see the callback catches it.
44
-
45
- Y.ann :x1, :a=>1
46
- Y.last_callback.should == [:ann, :x1, {:a => 1}]
47
-
48
- We will do it again to be sure.
49
-
50
- Y.ann :x1, :b=>2
51
- Y.last_callback.should == [:ann, :x1, {:a => 1, :b => 2}]
52
-
53
- ## Using Callbacks for Attribute Defaults
54
-
55
- class ::Module
56
- def annotation_added(key, ns)
57
- return unless ns == :ann
58
- base = self
59
- if value = ann(key, :default)
60
- define_method(key) do
61
- instance_variable_set("@#{key}", value) unless instance_variable_defined?("@#{key}")
62
- base.module_eval{ attr key }
63
- instance_variable_get("@#{key}")
64
- end
65
- end
66
- end
67
- end
68
-
69
- Try it out.
70
-
71
- class Z
72
- extend Anise::Annotations
73
-
74
- attr :a
75
- ann :a, :default => 10
76
- end
77
-
78
- z = Z.new
79
- z.a.should == 10
80
- z.a.should == 10
81
-
@@ -1,14 +0,0 @@
1
- # Annotative Attributes
2
-
3
- Create a class that uses the `Annotative::Attributes` mixin.
4
-
5
- class X
6
- extend Anise::Annotative::Attributes
7
-
8
- attr :a, :count => 1
9
- end
10
-
11
- Then we can see tht the attribute method `:a` has an annotation entry.
12
-
13
- X.ann(:a, :count) #=> 1
14
-
data/demo/04_methods.md DELETED
@@ -1,50 +0,0 @@
1
- # Method Annotations
2
-
3
- Create a class that uses the `Annotative::Methods` mixin.
4
-
5
- class X
6
- extend Anise::Annotative::Methods
7
-
8
- def self.doc(string)
9
- method_annotation(:doc=>string.to_s)
10
- end
11
-
12
- doc "See what I mean?"
13
-
14
- def see
15
- puts "Yes, I see!"
16
- end
17
- end
18
-
19
- See that it is set.
20
-
21
- X.ann(:see, :doc) #=> "See what I mean?"
22
-
23
- Method Annotators can override the standard annotation procedure
24
- with a custom procedure. In such case no annotations will actually
25
- be created unless the `#ann` is called in the procedure.
26
-
27
- class Y
28
- extend Anise::Annotative::Methods
29
-
30
- def self.list
31
- @list ||= []
32
- end
33
-
34
- def self.doc(string)
35
- method_annotation do |method|
36
- list << [method, string]
37
- end
38
- end
39
-
40
- doc "See here!"
41
-
42
- def see
43
- puts "Yes, I see!"
44
- end
45
- end
46
-
47
- See that it is set.
48
-
49
- Y.list #=> [[:see, "See here!"]]
50
-