decode 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0ee41a6017a7689ecfe8e5d45060f099389f42adef8881dbcc83c379ea0283a0
4
+ data.tar.gz: 381f84c1f1ae15d9486c07ac9f58f694169157200ad44c34e3ba5e2006de32d5
5
+ SHA512:
6
+ metadata.gz: c1b8322f13b93c5e0e6a64772b57e4dfb2eb6d8682404c69edfb233dc76bdaa795d3b9dfde2567f3240409041116e284790645583e32c9fecf6b0a9a5ea17d18
7
+ data.tar.gz: b4c8ab5a9b990107069fb618cc4bc2e64267372c639dc8d42c3de48f5ddb0543b5451e86b58ad016f649298ae84977518a77a7b9c008dc1e0a5974cf70bf4043
@@ -0,0 +1,50 @@
1
+ name: Development
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ${{matrix.os}}-latest
8
+ continue-on-error: ${{matrix.experimental}}
9
+
10
+ strategy:
11
+ matrix:
12
+ os:
13
+ - ubuntu
14
+
15
+ ruby:
16
+ - 2.5
17
+ - 2.6
18
+ - 2.7
19
+
20
+ experimental: [false]
21
+ env: [""]
22
+
23
+ include:
24
+ - os: ubuntu
25
+ ruby: truffleruby
26
+ experimental: true
27
+ - os: ubuntu
28
+ ruby: jruby
29
+ experimental: true
30
+ - os: ubuntu
31
+ ruby: head
32
+ experimental: true
33
+ - os: ubuntu
34
+ ruby: 2.6
35
+ experimental: false
36
+ env: COVERAGE=PartialSummary,Coveralls
37
+
38
+ steps:
39
+ - uses: actions/checkout@v1
40
+ - uses: ruby/setup-ruby@v1
41
+ with:
42
+ ruby-version: ${{matrix.ruby}}
43
+
44
+ - name: Install dependencies
45
+ run: ${{matrix.env}} bundle install
46
+
47
+ - name: Run tests
48
+ timeout-minutes: 5
49
+ run: |
50
+ ${{matrix.env}} bundle exec rspec
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --require spec_helper
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # Decode
2
+
3
+ A Ruby code analysis tool and documentation generator.
4
+
5
+ ## Contributing
6
+
7
+ 1. Fork it
8
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
9
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
10
+ 4. Push to the branch (`git push origin my-new-feature`)
11
+ 5. Create new Pull Request
12
+
13
+ ## License
14
+
15
+ Released under the MIT license.
16
+
17
+ Copyright, 2020, by [Samuel G. D. Williams](http://www.codeotaku.com).
18
+
19
+ Permission is hereby granted, free of charge, to any person obtaining a copy
20
+ of this software and associated documentation files (the "Software"), to deal
21
+ in the Software without restriction, including without limitation the rights
22
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23
+ copies of the Software, and to permit persons to whom the Software is
24
+ furnished to do so, subject to the following conditions:
25
+
26
+ The above copyright notice and this permission notice shall be included in
27
+ all copies or substantial portions of the Software.
28
+
29
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
35
+ THE SOFTWARE.
data/decode.gemspec ADDED
@@ -0,0 +1,33 @@
1
+
2
+ require_relative 'lib/decode/version'
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = "decode"
6
+ spec.version = Decode::VERSION
7
+ spec.authors = ["Samuel Williams"]
8
+ spec.email = ["samuel.williams@oriontransfer.co.nz"]
9
+
10
+ spec.summary = "Code analysis for documentation generation."
11
+ spec.homepage = "https://github.com/ioquatix/decode"
12
+ spec.license = "MIT"
13
+
14
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.add_dependency 'build-files'
26
+
27
+ spec.add_development_dependency 'bake-bundler'
28
+
29
+ spec.add_development_dependency 'utopia-wiki'
30
+ spec.add_development_dependency 'covered'
31
+ spec.add_development_dependency 'bundler'
32
+ spec.add_development_dependency 'rspec'
33
+ end
data/gems.locked ADDED
@@ -0,0 +1,169 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ decode (0.1.0)
5
+ build-files
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.0)
11
+ async (1.25.2)
12
+ console (~> 1.0)
13
+ nio4r (~> 2.3)
14
+ timers (~> 4.1)
15
+ async-container (0.16.4)
16
+ async (~> 1.0)
17
+ async-io (~> 1.26)
18
+ process-group
19
+ async-http (0.52.0)
20
+ async (~> 1.25)
21
+ async-io (~> 1.28)
22
+ async-pool (~> 0.2)
23
+ protocol-http (~> 0.18.0)
24
+ protocol-http1 (~> 0.12.0)
25
+ protocol-http2 (~> 0.14.0)
26
+ async-http-cache (0.2.0)
27
+ async-http (~> 0.51)
28
+ async-io (1.29.0)
29
+ async (~> 1.14)
30
+ async-pool (0.3.0)
31
+ async (~> 1.25)
32
+ async-rest (0.12.2)
33
+ async-http (~> 0.42)
34
+ protocol-http (~> 0.7)
35
+ bake (0.12.1)
36
+ samovar (~> 2.1)
37
+ bake-bundler (0.3.1)
38
+ bake (~> 0.9)
39
+ rspec
40
+ build-environment (1.13.0)
41
+ build-files (1.5.0)
42
+ rb-fsevent
43
+ rb-inotify
44
+ concurrent-ruby (1.1.6)
45
+ console (1.8.2)
46
+ covered (0.13.1)
47
+ async-rest
48
+ console (~> 1.0)
49
+ msgpack
50
+ parser
51
+ diff-lcs (1.3)
52
+ falcon (0.36.4)
53
+ async (~> 1.13)
54
+ async-container (~> 0.16.0)
55
+ async-http (~> 0.52.0)
56
+ async-http-cache (~> 0.2.0)
57
+ async-io (~> 1.22)
58
+ build-environment (~> 1.13)
59
+ localhost (~> 1.1)
60
+ process-metrics (~> 0.2.0)
61
+ rack (>= 1.0)
62
+ samovar (~> 2.1)
63
+ ffi (1.12.2)
64
+ http-accept (2.1.1)
65
+ kramdown (2.2.1)
66
+ rexml
67
+ kramdown-parser-gfm (1.1.0)
68
+ kramdown (~> 2.0)
69
+ localhost (1.1.6)
70
+ mail (2.7.1)
71
+ mini_mime (>= 0.1.1)
72
+ mapping (1.1.1)
73
+ mime-types (3.3.1)
74
+ mime-types-data (~> 3.2015)
75
+ mime-types-data (3.2020.0425)
76
+ mini_mime (1.0.2)
77
+ msgpack (1.3.3)
78
+ nio4r (2.5.2)
79
+ parser (2.7.1.2)
80
+ ast (~> 2.4.0)
81
+ process-group (1.2.1)
82
+ process-terminal (~> 0.2.0)
83
+ process-metrics (0.2.1)
84
+ console (~> 1.8)
85
+ samovar (~> 2.1)
86
+ process-terminal (0.2.0)
87
+ ffi
88
+ protocol-hpack (1.4.2)
89
+ protocol-http (0.18.0)
90
+ protocol-http1 (0.12.0)
91
+ protocol-http (~> 0.18)
92
+ protocol-http2 (0.14.0)
93
+ protocol-hpack (~> 1.4)
94
+ protocol-http (~> 0.18)
95
+ rack (2.2.2)
96
+ rackula (1.1.0)
97
+ falcon (~> 0.34)
98
+ samovar (~> 2.1)
99
+ variant
100
+ rake (13.0.1)
101
+ rake-compiler (1.1.0)
102
+ rake
103
+ rb-fsevent (0.10.3)
104
+ rb-inotify (0.10.1)
105
+ ffi (~> 1.0)
106
+ rexml (3.2.4)
107
+ rspec (3.9.0)
108
+ rspec-core (~> 3.9.0)
109
+ rspec-expectations (~> 3.9.0)
110
+ rspec-mocks (~> 3.9.0)
111
+ rspec-core (3.9.1)
112
+ rspec-support (~> 3.9.1)
113
+ rspec-expectations (3.9.1)
114
+ diff-lcs (>= 1.2.0, < 2.0)
115
+ rspec-support (~> 3.9.0)
116
+ rspec-mocks (3.9.1)
117
+ diff-lcs (>= 1.2.0, < 2.0)
118
+ rspec-support (~> 3.9.0)
119
+ rspec-support (3.9.2)
120
+ samovar (2.1.4)
121
+ console (~> 1.0)
122
+ mapping (~> 1.0)
123
+ thread-local (1.0.0)
124
+ timers (4.3.0)
125
+ trenni (3.9.0)
126
+ rake-compiler
127
+ utopia (2.14.0)
128
+ concurrent-ruby (~> 1.0)
129
+ console (~> 1.0)
130
+ http-accept (~> 2.1)
131
+ mail (~> 2.6)
132
+ mime-types (~> 3.0)
133
+ msgpack
134
+ rack (~> 2.2)
135
+ samovar (~> 2.1)
136
+ trenni (~> 3.0)
137
+ variant (~> 0.1)
138
+ utopia-gallery (2.5.0)
139
+ trenni (~> 3.9)
140
+ utopia (~> 2.0)
141
+ vips-thumbnail (~> 1.6)
142
+ utopia-wiki (0.3.0)
143
+ bake
144
+ falcon
145
+ kramdown
146
+ kramdown-parser-gfm
147
+ rackula
148
+ utopia (~> 2.14)
149
+ utopia-gallery
150
+ variant (0.1.1)
151
+ thread-local
152
+ vips (8.9.1)
153
+ ffi (~> 1.9)
154
+ vips-thumbnail (1.6.0)
155
+ vips (~> 8.9)
156
+
157
+ PLATFORMS
158
+ ruby
159
+
160
+ DEPENDENCIES
161
+ bake-bundler
162
+ bundler
163
+ covered
164
+ decode!
165
+ rspec
166
+ utopia-wiki
167
+
168
+ BUNDLED WITH
169
+ 2.1.4
data/gems.rb ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/lib/decode.rb ADDED
@@ -0,0 +1,21 @@
1
+ # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require_relative "decode/version"
@@ -0,0 +1,24 @@
1
+ # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ module Decode
22
+ class Index
23
+ end
24
+ end
@@ -0,0 +1,34 @@
1
+ # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require_relative 'language/ruby'
22
+
23
+ module Decode
24
+ module Language
25
+ def self.detect(path)
26
+ case File.extname(path)
27
+ when '.rb'
28
+ return Language::Ruby
29
+ else
30
+ raise ArgumentError, "Could not determine language for #{path}!"
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,80 @@
1
+ # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require_relative '../symbol'
22
+
23
+ module Decode
24
+ module Language
25
+ class Ruby
26
+ def initialize
27
+ end
28
+
29
+ PREFIX = {
30
+ class: '::',
31
+ module: '::',
32
+ def: '-',
33
+ }
34
+
35
+ def join(symbols, absolute = true)
36
+ buffer = String.new
37
+
38
+ symbols.each do |symbol|
39
+ if absolute == false
40
+ absolute = true
41
+ else
42
+ buffer << PREFIX[symbol.kind]
43
+ end
44
+
45
+ buffer << symbol.name
46
+ end
47
+ end
48
+
49
+ COMMENT = /\A\s*\#\s?(.*?)\Z/
50
+ DECLARATION = /\A(?<indentation>\s*)(?<text>(?<kind>module|class|def|attr)\s+(?<name>[\w\.\:]+).*)\Z/
51
+
52
+ def parse(input)
53
+ first = true
54
+ comments = []
55
+ nesting = []
56
+
57
+ input.each_line do |line|
58
+ line.chomp!
59
+
60
+ if match = line.match(COMMENT)
61
+ comments << match[1]
62
+ elsif match = line.match(DECLARATION)
63
+ level = match[:indentation].size
64
+ parent = nesting[level-1]
65
+
66
+ declaration = Declaration.new(match[:kind].to_sym, match[:name], match[:text], comments, parent: parent, language: self)
67
+
68
+ nesting[level] = declaration
69
+
70
+ yield declaration
71
+
72
+ comments = []
73
+ else
74
+ comments.clear
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,42 @@
1
+ # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require_relative 'language'
22
+
23
+ module Decode
24
+ class Source
25
+ def initialize(path, language = nil)
26
+ @path = path
27
+ @language = language || Language.detect(path).new
28
+ end
29
+
30
+ def parse(&block)
31
+ return to_enum(:parse) unless block_given?
32
+
33
+ self.open do |file|
34
+ @language.parse(file, &block)
35
+ end
36
+ end
37
+
38
+ def open(&block)
39
+ File.open(@path, &block)
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,57 @@
1
+ # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ module Decode
22
+ class Symbol
23
+ def initialize(kind, name, parent: nil, language: parent.language)
24
+ @kind = kind
25
+ @name = name
26
+ @parent = parent
27
+ @language = language
28
+ end
29
+
30
+ attr :kind
31
+ attr :name
32
+ attr :parent
33
+ attr :language
34
+
35
+ def full_name(parts = [])
36
+ if @parent
37
+ @parent.full_name(parts)
38
+ end
39
+
40
+ parts << self
41
+
42
+ @language.join(parts)
43
+ end
44
+ end
45
+
46
+ class Declaration < Symbol
47
+ def initialize(kind, name, text, comments, **options)
48
+ super(kind, name, **options)
49
+
50
+ @text = text
51
+ @comments = comments
52
+ end
53
+
54
+ attr :text
55
+ attr :comments
56
+ end
57
+ end
@@ -0,0 +1,23 @@
1
+ # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ module Decode
22
+ VERSION = "0.1.0"
23
+ end
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: decode
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Samuel Williams
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-04-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: build-files
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bake-bundler
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
42
+ name: utopia-wiki
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: covered
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description:
98
+ email:
99
+ - samuel.williams@oriontransfer.co.nz
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".github/workflows/development.yml"
105
+ - ".gitignore"
106
+ - ".rspec"
107
+ - README.md
108
+ - decode.gemspec
109
+ - gems.locked
110
+ - gems.rb
111
+ - lib/decode.rb
112
+ - lib/decode/index.rb
113
+ - lib/decode/language.rb
114
+ - lib/decode/language/ruby.rb
115
+ - lib/decode/source.rb
116
+ - lib/decode/symbol.rb
117
+ - lib/decode/version.rb
118
+ homepage: https://github.com/ioquatix/decode
119
+ licenses:
120
+ - MIT
121
+ metadata: {}
122
+ post_install_message:
123
+ rdoc_options: []
124
+ require_paths:
125
+ - lib
126
+ required_ruby_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: 2.3.0
131
+ required_rubygems_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ requirements: []
137
+ rubygems_version: 3.1.2
138
+ signing_key:
139
+ specification_version: 4
140
+ summary: Code analysis for documentation generation.
141
+ test_files: []