ruby_words 0.1.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.
- checksums.yaml +7 -0
- data/.rubocop.yml +8 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +31 -0
- data/Rakefile +10 -0
- data/exe/ruby_words +8 -0
- data/lib/ruby_words/version.rb +5 -0
- data/lib/ruby_words.rb +59 -0
- data/sig/ruby_words.rbs +4 -0
- metadata +71 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bb4ef1d8330ed9b812c07698d1c085c4472a43533dbedd6032e175c324312a00
|
4
|
+
data.tar.gz: 0f6b3bfb2dda65a7ad94011158f8bd6310c9cb779781f7d7edaf3d2f5421beb6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: da8429f9991a2ac433f74b94e588a90bd5a45d5d182018d9cf0c6609663d3eafe021ebb8dc8a8bac4ea6a031f1f03e82755cfa7b33547f98085275eb987eac4d
|
7
|
+
data.tar.gz: 2decb2934af4069004f0ac616376318303e09f1aca815990947a796b2bd655aeff91c183312786f92b57b41a8c6a29aaa5136119caa4b773cfd30fad83817df0
|
data/.rubocop.yml
ADDED
data/CHANGELOG.md
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2024 Andy Waite
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Ruby Words
|
2
|
+
|
3
|
+
This is a simple gem which emits a list of words used within the Ruby language. The intention is to use it for building programming dictionaries for tools such as [cspell](https://cspell.org).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Install the gem and add to the application's Gemfile by executing:
|
8
|
+
|
9
|
+
$ bundle add ruby_words
|
10
|
+
|
11
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
12
|
+
|
13
|
+
$ gem install ruby_wors
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
Install the gem, then run `ruby_words`.
|
18
|
+
|
19
|
+
## Development
|
20
|
+
|
21
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
22
|
+
|
23
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/andyw8/ruby_words.
|
28
|
+
|
29
|
+
## License
|
30
|
+
|
31
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/exe/ruby_words
ADDED
data/lib/ruby_words.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "ruby_words/version"
|
4
|
+
|
5
|
+
require "rbs"
|
6
|
+
|
7
|
+
module RubyWords
|
8
|
+
class Error < StandardError; end
|
9
|
+
|
10
|
+
class Ruby
|
11
|
+
def initialize
|
12
|
+
@method_names = []
|
13
|
+
end
|
14
|
+
|
15
|
+
def run
|
16
|
+
loader = RBS::EnvironmentLoader.new
|
17
|
+
RBS::Environment.from_loader(loader).resolve_type_names
|
18
|
+
|
19
|
+
loader.each_signature do |_source, pathname, _buffer, declarations, _directives|
|
20
|
+
process_signature(pathname, declarations)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def all
|
25
|
+
@method_names.uniq.sort
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def process_signature(pathname, declarations)
|
31
|
+
declarations.each do |declaration|
|
32
|
+
process_declaration(declaration, pathname)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def process_declaration(declaration, pathname)
|
37
|
+
case declaration
|
38
|
+
when RBS::AST::Declarations::Class, RBS::AST::Declarations::Module
|
39
|
+
handle_class_or_module_declaration(declaration, pathname)
|
40
|
+
else
|
41
|
+
# Other kinds not yet handled
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def handle_class_or_module_declaration(declaration, pathname)
|
46
|
+
declaration.members.each do |member|
|
47
|
+
case member
|
48
|
+
when RBS::AST::Members::MethodDefinition
|
49
|
+
handle_method(member)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def handle_method(member)
|
55
|
+
name = member.name.name
|
56
|
+
@method_names.append(*name.split("_"))
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/sig/ruby_words.rbs
ADDED
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruby_words
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andy Waite
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-10-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rbs
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.6'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.6'
|
27
|
+
description:
|
28
|
+
email:
|
29
|
+
- 13400+andyw8@users.noreply.github.com
|
30
|
+
executables:
|
31
|
+
- ruby_words
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- ".rubocop.yml"
|
36
|
+
- CHANGELOG.md
|
37
|
+
- LICENSE.txt
|
38
|
+
- README.md
|
39
|
+
- Rakefile
|
40
|
+
- exe/ruby_words
|
41
|
+
- lib/ruby_words.rb
|
42
|
+
- lib/ruby_words/version.rb
|
43
|
+
- sig/ruby_words.rbs
|
44
|
+
homepage: https://github.com/andyw8/ruby_words
|
45
|
+
licenses:
|
46
|
+
- MIT
|
47
|
+
metadata:
|
48
|
+
allowed_push_host: https://rubygems.org
|
49
|
+
homepage_uri: https://github.com/andyw8/ruby_words
|
50
|
+
source_code_uri: https://github.com/andyw8/ruby_words
|
51
|
+
changelog_uri: https://github.com/andyw8/ruby-lsp/releases
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 3.0.0
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements: []
|
67
|
+
rubygems_version: 3.5.3
|
68
|
+
signing_key:
|
69
|
+
specification_version: 4
|
70
|
+
summary: A list of words from the Ruby programming language
|
71
|
+
test_files: []
|