ruby_mod_kit 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +99 -0
  4. data/examples/user.rb +83 -0
  5. data/examples/user.rbm +47 -0
  6. data/exe/ruby_mod_kit +5 -0
  7. data/lib/ruby_mod_kit/cli.rb +27 -0
  8. data/lib/ruby_mod_kit/generation.rb +170 -0
  9. data/lib/ruby_mod_kit/memo/class.rb +27 -0
  10. data/lib/ruby_mod_kit/memo/ivar.rb +42 -0
  11. data/lib/ruby_mod_kit/memo/method.rb +49 -0
  12. data/lib/ruby_mod_kit/memo/offset_memo.rb +26 -0
  13. data/lib/ruby_mod_kit/memo/parameter.rb +39 -0
  14. data/lib/ruby_mod_kit/memo.rb +73 -0
  15. data/lib/ruby_mod_kit/mission/fix_parse_error.rb +213 -0
  16. data/lib/ruby_mod_kit/mission/ivar_arg.rb +42 -0
  17. data/lib/ruby_mod_kit/mission/overload.rb +73 -0
  18. data/lib/ruby_mod_kit/mission/type_attr.rb +75 -0
  19. data/lib/ruby_mod_kit/mission/type_parameter.rb +39 -0
  20. data/lib/ruby_mod_kit/mission/type_return.rb +33 -0
  21. data/lib/ruby_mod_kit/mission.rb +40 -0
  22. data/lib/ruby_mod_kit/node/call_node.rb +30 -0
  23. data/lib/ruby_mod_kit/node/class_node.rb +37 -0
  24. data/lib/ruby_mod_kit/node/def_node.rb +57 -0
  25. data/lib/ruby_mod_kit/node/parameter_node.rb +42 -0
  26. data/lib/ruby_mod_kit/node/program_node.rb +23 -0
  27. data/lib/ruby_mod_kit/node/statements_node.rb +27 -0
  28. data/lib/ruby_mod_kit/node/symbol_node.rb +34 -0
  29. data/lib/ruby_mod_kit/node/untyped_node.rb +25 -0
  30. data/lib/ruby_mod_kit/node.rb +164 -0
  31. data/lib/ruby_mod_kit/offset_diff.rb +37 -0
  32. data/lib/ruby_mod_kit/transpiler.rb +20 -0
  33. data/lib/ruby_mod_kit/version.rb +7 -0
  34. data/lib/ruby_mod_kit.rb +59 -0
  35. data/ruby_mod_kit.gemspec +51 -0
  36. data/sig/generated/examples/user.rbs +60 -0
  37. data/sig/generated/ruby_mod_kit/cli.rbs +14 -0
  38. data/sig/generated/ruby_mod_kit/generation.rbs +101 -0
  39. data/sig/generated/ruby_mod_kit/memo/class.rbs +20 -0
  40. data/sig/generated/ruby_mod_kit/memo/ivar.rbs +30 -0
  41. data/sig/generated/ruby_mod_kit/memo/located.rbs +14 -0
  42. data/sig/generated/ruby_mod_kit/memo/method.rbs +37 -0
  43. data/sig/generated/ruby_mod_kit/memo/offset_memo.rbs +20 -0
  44. data/sig/generated/ruby_mod_kit/memo/parameter.rbs +33 -0
  45. data/sig/generated/ruby_mod_kit/memo/parameter_type.rbs +14 -0
  46. data/sig/generated/ruby_mod_kit/memo.rbs +41 -0
  47. data/sig/generated/ruby_mod_kit/mission/fix_parse_error.rbs +73 -0
  48. data/sig/generated/ruby_mod_kit/mission/ivar_arg.rbs +19 -0
  49. data/sig/generated/ruby_mod_kit/mission/overload.rbs +20 -0
  50. data/sig/generated/ruby_mod_kit/mission/type_attr.rbs +18 -0
  51. data/sig/generated/ruby_mod_kit/mission/type_parameter.rbs +18 -0
  52. data/sig/generated/ruby_mod_kit/mission/type_return.rbs +18 -0
  53. data/sig/generated/ruby_mod_kit/mission.rbs +25 -0
  54. data/sig/generated/ruby_mod_kit/node/call_node.rbs +25 -0
  55. data/sig/generated/ruby_mod_kit/node/class_node.rbs +29 -0
  56. data/sig/generated/ruby_mod_kit/node/def_node.rbs +39 -0
  57. data/sig/generated/ruby_mod_kit/node/parameter_node.rbs +26 -0
  58. data/sig/generated/ruby_mod_kit/node/program_node.rbs +16 -0
  59. data/sig/generated/ruby_mod_kit/node/statements_node.rbs +21 -0
  60. data/sig/generated/ruby_mod_kit/node/symbol_node.rbs +24 -0
  61. data/sig/generated/ruby_mod_kit/node/untyped_node.rbs +21 -0
  62. data/sig/generated/ruby_mod_kit/node.rbs +63 -0
  63. data/sig/generated/ruby_mod_kit/offset_diff.rbs +20 -0
  64. data/sig/generated/ruby_mod_kit/transpiler.rbs +11 -0
  65. data/sig/generated/ruby_mod_kit/version.rbs +5 -0
  66. data/sig/generated/ruby_mod_kit.rbs +33 -0
  67. data/sig/sorted_set.rbs +8 -0
  68. data/sig/thor.rbs +3 -0
  69. metadata +157 -0
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rbs_inline: enabled
4
+
5
+ module RubyModKit
6
+ class Node
7
+ # Transpiler program node
8
+ class DefNode < Node
9
+ # @rbs @prism_node: Prism::DefNode
10
+ # @rbs @parent: Node
11
+
12
+ attr_reader :prism_node #: Prism::DefNode
13
+ attr_reader :parent #: Node
14
+
15
+ # @rbs prism_node: Prism::DefNode
16
+ # @rbs parent: Node
17
+ # @rbs return: void
18
+ def initialize(prism_node, parent:)
19
+ @prism_node = prism_node
20
+ @parent = parent
21
+ raise RubyModKit::Error unless prism_node.is_a?(Prism::DefNode)
22
+
23
+ super()
24
+ end
25
+
26
+ # @rbs return: Symbol
27
+ def name
28
+ @prism_node.name
29
+ end
30
+
31
+ # @rbs return: Prism::Location | nil
32
+ def body_location
33
+ prism_node.body&.location
34
+ end
35
+
36
+ # @rbs return: Prism::Location | nil
37
+ def lparen_loc
38
+ @prism_node.lparen_loc
39
+ end
40
+
41
+ # @rbs return: Prism::Location | nil
42
+ def rparen_loc
43
+ @prism_node.rparen_loc
44
+ end
45
+
46
+ # @rbs return: Prism::Location
47
+ def name_loc
48
+ @prism_node.name_loc
49
+ end
50
+
51
+ # @rbs return: Prism::Location | nil
52
+ def end_keyword_loc
53
+ @prism_node.end_keyword_loc
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rbs_inline: enabled
4
+
5
+ module RubyModKit
6
+ class Node
7
+ # Transpiler program node
8
+ class ParameterNode < Node
9
+ # @rbs!
10
+ # type prism_node = Prism::RequiredParameterNode | Prism::OptionalKeywordParameterNode
11
+ # | Prism::OptionalParameterNode | Prism::RequiredKeywordParameterNode
12
+ # | Prism::RestParameterNode
13
+
14
+ # @rbs @prism_node: prism_node
15
+ # @rbs @parent: Node
16
+
17
+ attr_reader :prism_node #: prism_node
18
+ attr_reader :parent #: Node
19
+
20
+ # @rbs prism_node: prism_node
21
+ # @rbs parent: Node
22
+ # @rbs return: void
23
+ def initialize(prism_node, parent:)
24
+ @prism_node = prism_node
25
+ @parent = parent
26
+ case prism_node
27
+ when Prism::RequiredParameterNode, Prism::OptionalKeywordParameterNode,
28
+ Prism::OptionalParameterNode, Prism::RequiredKeywordParameterNode,
29
+ Prism::RestParameterNode
30
+ super()
31
+ else
32
+ raise RubyModKit::Error, "unexpected prism node #{prism_node.class}"
33
+ end
34
+ end
35
+
36
+ # @rbs return: Symbol | nil
37
+ def name
38
+ @prism_node.name
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rbs_inline: enabled
4
+
5
+ module RubyModKit
6
+ class Node
7
+ # Transpiler program node
8
+ class ProgramNode < Node
9
+ # @rbs @prism_node: Prism::ProgramNode
10
+
11
+ attr_reader :prism_node #: Prism::ProgramNode
12
+
13
+ # @rbs prism_node: Prism::ProgramNode
14
+ # @rbs return: void
15
+ def initialize(prism_node)
16
+ @prism_node = prism_node
17
+ raise RubyModKit::Error unless prism_node.is_a?(Prism::ProgramNode)
18
+
19
+ super()
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rbs_inline: enabled
4
+
5
+ module RubyModKit
6
+ class Node
7
+ # Transpiler program node
8
+ class StatementsNode < Node
9
+ # @rbs @prism_node: Prism::StatementsNode
10
+ # @rbs @parent: Node
11
+
12
+ attr_reader :prism_node #: Prism::StatementsNode
13
+ attr_reader :parent #: Node
14
+
15
+ # @rbs prism_node: Prism::StatementsNode
16
+ # @rbs parent: Node
17
+ # @rbs return: void
18
+ def initialize(prism_node, parent:)
19
+ @prism_node = prism_node
20
+ @parent = parent
21
+ raise RubyModKit::Error unless prism_node.is_a?(Prism::StatementsNode)
22
+
23
+ super()
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rbs_inline: enabled
4
+
5
+ module RubyModKit
6
+ class Node
7
+ # Transpiler program node
8
+ class SymbolNode < Node
9
+ # @rbs @prism_node: Prism::SymbolNode
10
+ # @rbs @parent: Node
11
+
12
+ attr_reader :prism_node #: Prism::SymbolNode
13
+ attr_reader :parent #: Node
14
+
15
+ # @rbs prism_node: Prism::SymbolNode
16
+ # @rbs parent: Node
17
+ # @rbs return: void
18
+ def initialize(prism_node, parent:)
19
+ @prism_node = prism_node
20
+ @parent = parent
21
+ raise RubyModKit::Error unless prism_node.is_a?(Prism::SymbolNode)
22
+
23
+ super()
24
+ end
25
+
26
+ # @rbs return: nil | Symbol
27
+ def value
28
+ return @value if defined?(@value)
29
+
30
+ @value = @prism_node.value&.to_sym
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rbs_inline: enabled
4
+
5
+ module RubyModKit
6
+ class Node
7
+ # Transpiler program node
8
+ class UntypedNode < Node
9
+ # @rbs @prism_node: Prism::Node
10
+ # @rbs @parent: Node
11
+
12
+ attr_reader :prism_node #: Prism::Node
13
+ attr_reader :parent #: Node
14
+
15
+ # @rbs prism_node: Prism::Node
16
+ # @rbs parent: Node
17
+ # @rbs return: void
18
+ def initialize(prism_node, parent:)
19
+ @prism_node = prism_node
20
+ @parent = parent
21
+ super()
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,164 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rbs_inline: enabled
4
+
5
+ module RubyModKit
6
+ # The class of transpile node.
7
+ class Node
8
+ # @rbs @location: Prism::Location
9
+ # @rbs @children: Array[Node]
10
+ # @rbs @ancestors: Array[Node]
11
+
12
+ attr_reader :location #: Prism::Location
13
+
14
+ # @rbs return: void
15
+ def initialize
16
+ @location = prism_node.location
17
+ end
18
+
19
+ # @rbs return: Array[Node]
20
+ def children
21
+ return @children if @children
22
+
23
+ @children = prism_node.child_nodes.compact.map do |prism_child_node|
24
+ wrap(prism_child_node)
25
+ end
26
+ end
27
+
28
+ # @rbs prism_node: Prism::Node
29
+ # @rbs return: Node
30
+ def wrap(prism_node)
31
+ case prism_node
32
+ when Prism::SymbolNode
33
+ Node::SymbolNode.new(prism_node, parent: self)
34
+ when Prism::ClassNode
35
+ Node::ClassNode.new(prism_node, parent: self)
36
+ when Prism::DefNode
37
+ Node::DefNode.new(prism_node, parent: self)
38
+ when Prism::RequiredParameterNode, Prism::OptionalKeywordParameterNode,
39
+ Prism::OptionalParameterNode, Prism::RequiredKeywordParameterNode,
40
+ Prism::RestParameterNode
41
+ Node::ParameterNode.new(prism_node, parent: self)
42
+ when Prism::StatementsNode
43
+ Node::StatementsNode.new(prism_node, parent: self)
44
+ when Prism::CallNode
45
+ Node::CallNode.new(prism_node, parent: self)
46
+ else
47
+ Node::UntypedNode.new(prism_node, parent: self)
48
+ end
49
+ end
50
+
51
+ # @rbs return: Array[Node]
52
+ def ancestors
53
+ return @ancestors if @ancestors
54
+
55
+ parent = @parent
56
+ @ancestors = if parent
57
+ [parent] + parent.ancestors
58
+ else
59
+ []
60
+ end
61
+ end
62
+
63
+ # @rbs return: Symbol
64
+ def name
65
+ raise(RubyModKit::Error, "Expected ParameterNode but #{self.class}:#{prism_node.inspect}")
66
+ end
67
+
68
+ # @rbs offset: Integer
69
+ # @rbs return: Node | nil
70
+ def node_at(offset)
71
+ return nil unless include?(offset)
72
+
73
+ child = children.find { _1.include?(offset) }
74
+ child&.node_at(offset) || self
75
+ end
76
+
77
+ # @rbs offset: Integer
78
+ # @rbs return: Node::StatementsNode | nil
79
+ def statements_node_at(offset)
80
+ node = node_at(offset) || return
81
+ [node, *node.ancestors].each { return _1 if _1.is_a?(Node::StatementsNode) }
82
+ nil
83
+ end
84
+
85
+ # @rbs offset: Integer
86
+ # @rbs return: Node::DefNode | nil
87
+ def def_node_at(offset)
88
+ node = node_at(offset) || return
89
+ [node, *node.ancestors].each { return _1 if _1.is_a?(Node::DefNode) }
90
+ nil
91
+ end
92
+
93
+ # @rbs offset: Integer
94
+ # @rbs return: Node::ParameterNode | nil
95
+ def parameter_node_at(offset)
96
+ node = node_at(offset) || return
97
+ [node, *node.ancestors].each { return _1 if _1.is_a?(Node::ParameterNode) }
98
+ nil
99
+ end
100
+
101
+ # @rbs offset: Integer
102
+ # @rbs return: Node::ClassNode | nil
103
+ def class_node_at(offset)
104
+ node = node_at(offset) || return
105
+ [node, *node.ancestors].each { return _1 if _1.is_a?(Node::ClassNode) }
106
+ nil
107
+ end
108
+
109
+ # @rbs offset: Integer
110
+ # @rbs return: bool
111
+ def include?(offset)
112
+ self.offset <= offset && offset <= prism_node.location.end_offset
113
+ end
114
+
115
+ # @rbs return: Prism::Node & Prism::_Node
116
+ def prism_node
117
+ raise RubyModKit::Error
118
+ end
119
+
120
+ # @rbs return: Integer
121
+ def offset
122
+ location.start_offset
123
+ end
124
+
125
+ # @rbs return: String
126
+ def inspect
127
+ str = +"#<#{self.class} "
128
+ first = true
129
+ instance_variables.each do |ivar_name|
130
+ case ivar_name
131
+ when :@children, :@ancestors, :@parent
132
+ next
133
+ end
134
+
135
+ if first
136
+ first = false
137
+ else
138
+ str << ", "
139
+ end
140
+ str << "#{ivar_name}="
141
+ value = instance_variable_get(ivar_name)
142
+ str << (
143
+ case value
144
+ when Prism::Node
145
+ "#<#{value.class} location=#{value.location.inspect}>"
146
+ else
147
+ value.inspect
148
+ end
149
+ )
150
+ end
151
+ str << ">"
152
+ str
153
+ end
154
+ end
155
+ end
156
+
157
+ require_relative "node/symbol_node"
158
+ require_relative "node/class_node"
159
+ require_relative "node/call_node"
160
+ require_relative "node/def_node"
161
+ require_relative "node/parameter_node"
162
+ require_relative "node/program_node"
163
+ require_relative "node/statements_node"
164
+ require_relative "node/untyped_node"
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rbs_inline: enabled
4
+
5
+ require "sorted_set"
6
+
7
+ module RubyModKit
8
+ # The class of offset differences.
9
+ class OffsetDiff
10
+ # @rbs @diffs: SortedSet[[Integer, Integer, Integer]]
11
+
12
+ # @rbs return: void
13
+ def initialize
14
+ @diffs = SortedSet.new
15
+ end
16
+
17
+ # @rbs src_offset: Integer
18
+ # @rbs return: Integer
19
+ def [](src_offset)
20
+ dst_offset = src_offset
21
+ @diffs.each do |(offset, _, diff)|
22
+ break if offset > src_offset
23
+ break if offset == src_offset && diff < 0
24
+
25
+ dst_offset += diff
26
+ end
27
+ dst_offset
28
+ end
29
+
30
+ # @rbs src_offset: Integer
31
+ # @rbs new_diff: Integer
32
+ # @rbs return: void
33
+ def insert(src_offset, new_diff)
34
+ @diffs << [src_offset, @diffs.size, new_diff]
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rbs_inline: enabled
4
+
5
+ module RubyModKit
6
+ # The class of transpiler.
7
+ class Transpiler
8
+ # @rbs src: String
9
+ # @rbs filename: String | nil
10
+ # @rbs return: String
11
+ def transpile(src, filename: nil)
12
+ generation = Generation.new(src.dup, filename: filename)
13
+ until generation.completed?
14
+ generation.resolve
15
+ generation = generation.succ
16
+ end
17
+ generation.script
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rbs_inline: enabled
4
+
5
+ module RubyModKit
6
+ VERSION = "0.0.1" #: String
7
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rbs_inline: enabled
4
+
5
+ require "rbconfig"
6
+ require "prism"
7
+
8
+ # The root namespace for ruby_mod_kit.
9
+ module RubyModKit
10
+ class Error < StandardError; end
11
+ class SyntaxError < ::SyntaxError; end
12
+
13
+ class << self
14
+ # @rbs file: String
15
+ # @rbs *args: String
16
+ # @rbs return: void
17
+ def execute_file(file, *args)
18
+ rb_file = transpile_file(file)
19
+ execute_rb_file(rb_file, *args)
20
+ end
21
+
22
+ # @rbs file: String
23
+ # @rbs return: String
24
+ def transpile_file(file)
25
+ rb_src = transpile(File.read(file), filename: file)
26
+ rb_path = rb_path(file)
27
+ File.write(rb_path, rb_src)
28
+ rb_path
29
+ end
30
+
31
+ # @rbs src: String
32
+ # @rbs filename: String | nil
33
+ # @rbs return: String
34
+ def transpile(src, filename: nil)
35
+ Transpiler.new.transpile(src, filename: filename)
36
+ end
37
+
38
+ # @rbs file: String
39
+ # @rbs *args: String
40
+ # @rbs return: void
41
+ def execute_rb_file(file, *args)
42
+ system(RbConfig.ruby, file, *args)
43
+ end
44
+
45
+ # @rbs path: String
46
+ # @rbs return: String
47
+ def rb_path(path)
48
+ path.sub(/(?:\.rbm)?$/, ".rb")
49
+ end
50
+ end
51
+ end
52
+
53
+ require_relative "ruby_mod_kit/version"
54
+ require_relative "ruby_mod_kit/transpiler"
55
+ require_relative "ruby_mod_kit/generation"
56
+ require_relative "ruby_mod_kit/memo"
57
+ require_relative "ruby_mod_kit/node"
58
+ require_relative "ruby_mod_kit/mission"
59
+ require_relative "ruby_mod_kit/offset_diff"
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/ruby_mod_kit/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "ruby_mod_kit"
7
+ spec.authors = ["wanabe"]
8
+ spec.email = ["s.wanabe@gmail.com"]
9
+
10
+ version = RubyModKit::VERSION
11
+ tag_version = `git tag --points-at HEAD`.chomp.sub("v", "")
12
+ version += "-#{`git rev-parse --short HEAD`}" if version != tag_version
13
+ spec.version = version
14
+
15
+ spec.summary = "ruby_mod_kit"
16
+ spec.description = "ruby_mod_kit"
17
+ spec.homepage = "https://github.com/wanabe/ruby_mod_kit"
18
+ spec.license = "MIT"
19
+ spec.required_ruby_version = ">= 2.7.0"
20
+
21
+ spec.metadata["homepage_uri"] = spec.homepage
22
+ spec.metadata["source_code_uri"] = spec.homepage
23
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
24
+
25
+ spec.metadata["rubygems_mfa_required"] = "true"
26
+
27
+ # Specify which files should be added to the gem when it is released.
28
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
29
+ spec.files = Dir.chdir(__dir__) do
30
+ `git ls-files -z`.split("\x0").reject do |f|
31
+ next true if File.expand_path(f) == __FILE__
32
+ next false if f =~ %r{\Aexamples/.*rbm?\z}
33
+ next true if f.start_with?(*%w[bin/ test/ spec/ features/ coverage/ bin/ .git])
34
+ next true if %w[Gemfile Gemfile.lock .rspec .rubocop.yml Rakefile Steepfile].include?(f)
35
+ next true if f.end_with?(".rbm")
36
+
37
+ false
38
+ end
39
+ end
40
+ spec.bindir = "exe"
41
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
42
+ spec.require_paths = ["lib"]
43
+
44
+ # Uncomment to register a new dependency of your gem
45
+ spec.add_dependency "prism", "~> 1.0"
46
+ spec.add_dependency "sorted_set", "~> 1.0"
47
+ spec.add_dependency "thor", "~> 1.3"
48
+
49
+ # For more information and examples about making a new gem, check out our
50
+ # guide at: https://bundler.io/guides/creating_gem.html
51
+ end
@@ -0,0 +1,60 @@
1
+ # Generated from examples/user.rb with RBS::Inline
2
+
3
+ # Example class
4
+ class User
5
+ @email: String
6
+
7
+ @tel: nil | String
8
+
9
+ @nick: nil | String
10
+
11
+ attr_reader email: String
12
+
13
+ attr_reader name: nil | String
14
+
15
+ attr_reader nick: nil | String
16
+
17
+ # @rbs email: String
18
+ # @rbs tel: nil | String
19
+ # @rbs name: nil | String
20
+ # @rbs nick: nil | String
21
+ # @rbs return: void
22
+ def initialize: (String email, ?nil | String tel, ?name: nil | String, ?nick: nil | String) -> void
23
+ end
24
+
25
+ # Example class
26
+ class Pos
27
+ @x: Integer
28
+
29
+ @y: Integer
30
+
31
+ @z: Integer
32
+
33
+ attr_reader x: Integer
34
+
35
+ attr_reader y: Integer
36
+
37
+ attr_reader z: Integer
38
+
39
+ # @rbs x: Integer
40
+ # @rbs y: Integer
41
+ # @rbs z: Integer
42
+ # @rbs return: void
43
+ def initialize: (Integer x, Integer y, ?Integer z) -> void
44
+
45
+ # @rbs (Pos) -> Integer
46
+ # | (Integer) -> Pos
47
+ def *: (Pos) -> Integer
48
+ | (Integer) -> Pos
49
+
50
+ # @rbs other: Pos
51
+ # @rbs return: Integer
52
+ def _mul__overload0: (Pos other) -> Integer
53
+
54
+ # @rbs n: Integer
55
+ # @rbs return: Pos
56
+ def _mul__overload1: (Integer n) -> Pos
57
+
58
+ # @rbs return: String
59
+ def to_s: () -> String
60
+ end
@@ -0,0 +1,14 @@
1
+ # Generated from lib/ruby_mod_kit/cli.rb with RBS::Inline
2
+
3
+ module RubyModKit
4
+ # This class provides CLI commands of ruby_mod_kit.
5
+ class CLI < Thor
6
+ # @rbs *args: String
7
+ # @rbs return: void
8
+ def exec: (*String args) -> void
9
+
10
+ # @rbs *args: String
11
+ # @rbs return: void
12
+ def transpile: (*String args) -> void
13
+ end
14
+ end