protocol 0.9.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,55 +1,91 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: protocol
3
- version: !ruby/object:Gem::Version
4
- version: 0.9.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Florian Frank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
-
12
- date: 2009-08-11 00:00:00 +02:00
13
- default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: ParseTree
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
11
+ date: 2013-07-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gem_hadar
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.8
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
21
24
  - - ~>
22
- - !ruby/object:Gem::Version
23
- version: "3.0"
24
- version:
25
- - !ruby/object:Gem::Dependency
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.8
27
+ - !ruby/object:Gem::Dependency
28
+ name: simplecov
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
26
42
  name: ruby_parser
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
27
48
  type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
31
52
  - - ~>
32
- - !ruby/object:Gem::Version
33
- version: "2.0"
34
- version:
35
- description: This library offers an implementation of protocols against which you can check the conformity of your classes or instances of your classes. They are a bit like Java Interfaces, but as mixin modules they can also contain already implemented methods. Additionaly you can define preconditions/postconditions for methods specified in a protocol.
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: |
56
+ This library offers an implementation of protocols against which you can check
57
+ the conformity of your classes or instances of your classes. They are a bit
58
+ like Java Interfaces, but as mixin modules they can also contain already
59
+ implemented methods. Additionaly you can define preconditions/postconditions
60
+ for methods specified in a protocol.
36
61
  email: flori@ping.de
37
62
  executables: []
38
-
39
63
  extensions: []
40
-
41
- extra_rdoc_files:
42
- - doc-main.txt
43
- files:
64
+ extra_rdoc_files:
65
+ - README.rdoc
66
+ - lib/protocol.rb
67
+ - lib/protocol/core.rb
68
+ - lib/protocol/descriptor.rb
69
+ - lib/protocol/errors.rb
70
+ - lib/protocol/message.rb
71
+ - lib/protocol/method_parser/ruby_parser.rb
72
+ - lib/protocol/post_condition.rb
73
+ - lib/protocol/protocol_module.rb
74
+ - lib/protocol/utilities.rb
75
+ - lib/protocol/version.rb
76
+ - lib/protocol/xt.rb
77
+ files:
78
+ - .gitignore
79
+ - .travis.yml
44
80
  - CHANGES
45
81
  - COPYING
82
+ - Gemfile
83
+ - README.rdoc
46
84
  - Rakefile
47
85
  - VERSION
48
- - benchmarks
49
- - benchmarks/data
86
+ - benchmarks/data/.keep
50
87
  - benchmarks/method_parser.rb
51
- - doc-main.txt
52
- - examples
88
+ - examples/assignments.rb
53
89
  - examples/comparing.rb
54
90
  - examples/enumerating.rb
55
91
  - examples/game.rb
@@ -59,45 +95,49 @@ files:
59
95
  - examples/queue.rb
60
96
  - examples/stack.rb
61
97
  - install.rb
62
- - lib
63
- - lib/protocol
64
98
  - lib/protocol.rb
65
99
  - lib/protocol/core.rb
66
- - lib/protocol/method_parser
67
- - lib/protocol/method_parser/parse_tree.rb
100
+ - lib/protocol/descriptor.rb
101
+ - lib/protocol/errors.rb
102
+ - lib/protocol/message.rb
68
103
  - lib/protocol/method_parser/ruby_parser.rb
104
+ - lib/protocol/post_condition.rb
105
+ - lib/protocol/protocol_module.rb
106
+ - lib/protocol/utilities.rb
69
107
  - lib/protocol/version.rb
70
- - make_doc.rb
108
+ - lib/protocol/xt.rb
71
109
  - protocol.gemspec
72
- - tests
73
- - tests/test_protocol.rb
74
- - tests/test_protocol_method_parser.rb
75
- has_rdoc: true
76
- homepage: http://protocol.rubyforge.org
110
+ - tests/protocol_method_parser_test.rb
111
+ - tests/protocol_test.rb
112
+ - tests/test_helper.rb
113
+ homepage: http://flori.github.com/protocol
114
+ licenses: []
115
+ metadata: {}
77
116
  post_install_message:
78
- rdoc_options:
117
+ rdoc_options:
118
+ - --title
119
+ - Protocol - Method Protocols for Ruby Classes
79
120
  - --main
80
- - doc-main.txt
81
- require_paths:
121
+ - README.rdoc
122
+ require_paths:
82
123
  - lib
83
- required_ruby_version: !ruby/object:Gem::Requirement
84
- requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- version: "0"
88
- version:
89
- required_rubygems_version: !ruby/object:Gem::Requirement
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- version: "0"
94
- version:
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - '>='
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
95
134
  requirements: []
96
-
97
- rubyforge_project: protocol
98
- rubygems_version: 1.3.1
135
+ rubyforge_project:
136
+ rubygems_version: 2.0.4
99
137
  signing_key:
100
- specification_version: 2
138
+ specification_version: 4
101
139
  summary: Method Protocols for Ruby Classes
102
- test_files:
103
- - tests/test_protocol.rb
140
+ test_files:
141
+ - tests/protocol_method_parser_test.rb
142
+ - tests/protocol_test.rb
143
+ - tests/test_helper.rb
@@ -1,124 +0,0 @@
1
- require 'parse_tree'
2
- require 'sexp_processor'
3
-
4
- module Protocol
5
- # Parse protocol method definition to derive a Message specification.
6
- class MethodParser < SexpProcessor
7
- # Create a new MethodParser instance for method +methodname+ of module
8
- # +modul+. For eigenmethods set +eigenclass+ to true, otherwise bad things
9
- # will happen.
10
- def initialize(modul, methodname, eigenclass = false)
11
- super()
12
- @method = Module === modul ?
13
- modul.instance_method(methodname) :
14
- modul.method(methodname)
15
- self.strict = false
16
- self.auto_shift_type = true
17
- @complex = false
18
- @first_defn = true
19
- @first_block = true
20
- @args = []
21
- @arg_kinds = []
22
- @arity = @method.arity
23
- parsed = ParseTree.new.parse_tree_for_method(modul, methodname, eigenclass)
24
- process parsed
25
- end
26
-
27
- # Process +exp+, but catch UnsupportedNodeError exceptions and ignore them.
28
- def process(exp)
29
- super
30
- rescue UnsupportedNodeError => ignore
31
- end
32
-
33
- # Returns the names of the arguments of the parsed method.
34
- attr_reader :args
35
-
36
- def arg(i)
37
- @args[i]
38
- end
39
-
40
- # Returns the names of the arguments of the parsed method.
41
- attr_reader :arg_kinds
42
-
43
- def arg_kind(i)
44
- @arg_kinds[i]
45
- end
46
-
47
- # Returns the arity of the parsed method.
48
- attr_reader :arity
49
-
50
- # Return true if this protocol method is a complex method, which ought to
51
- # be called for checking conformance to the protocol.
52
- def complex?
53
- @complex
54
- end
55
-
56
- # Return true if a block argument was detected.
57
- def block_arg?
58
- @arg_kinds.last == :block
59
- end
60
-
61
- # Only consider first the first defn, skip inner method definitions.
62
- def process_defn(exp)
63
- if @first_defn
64
- @first_defn = false
65
- _name, scope = exp
66
- process scope
67
- end
68
- exp.clear
69
- s :dummy
70
- end
71
-
72
- # Remember the argument names in +exp+ in the args attribute.
73
- def process_args(exp)
74
- @args.replace exp.select { |x| x.is_a? Symbol }
75
- @arg_kinds = @args.map { |a| a.to_s[0] == ?* ? :rest : :req }
76
- if block = exp.find { |x| x.is_a?(Array) and x.first == :block }
77
- lasgns = block[1..-1].transpose[1]
78
- i = args.size - 1
79
- @args.reverse_each do |a|
80
- exp.first
81
- l = lasgns.last
82
- if a == l
83
- @arg_kinds[i] = :opt
84
- lasgns.pop
85
- end
86
- i -= 1
87
- end
88
- end
89
- exp.clear
90
- s :dummy
91
- end
92
-
93
- # Remember if we encounter a block argument.
94
- def process_block_arg(exp)
95
- @args.push :"&#{exp.first}"
96
- @arg_kinds.push :block
97
- exp.clear
98
- s :dummy
99
- end
100
-
101
- # Remember if we encounter a yield keyword.
102
- def process_yield(exp)
103
- if @arg_kinds.last != :block
104
- @args.push :'&block'
105
- @arg_kinds.push :block
106
- end
107
- exp.clear
108
- s :dummy
109
- end
110
-
111
- # We only consider the first block in +exp+ (can there be more than one?),
112
- # and then try to figure out, if this is a complex method or not. Continue
113
- # processing the +exp+ tree after that.
114
- def process_block(exp)
115
- if @first_block
116
- @first_block = false
117
- @complex = exp.flatten.any? { |e| [ :call, :fcall, :vcall ].include?(e) }
118
- exp.each { |e| process e }
119
- end
120
- exp.clear
121
- s :dummy
122
- end
123
- end
124
- end
data/make_doc.rb DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- $outdir = 'doc/'
4
- puts "Creating documentation in '#$outdir'."
5
- system "rdoc --main=doc-main.txt -o #$outdir doc-main.txt #{Dir['lib/**/*.rb'] * ' '}"