Skip to content

Commit ddbeaf3

Browse files
committed
Set up typechecking for DSL blocks
1 parent 66f5111 commit ddbeaf3

File tree

6 files changed

+28
-3
lines changed

6 files changed

+28
-3
lines changed

dsl/prototype.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# typed: false
1+
# typed: true
22
# frozen_string_literal: true
33

4+
#: self as Roast::DSL::Executor
5+
46
config do
57
cmd(:echo) { print_all! }
68
end

lib/roast/dsl/config_context.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# typed: false
1+
# typed: true
22
# frozen_string_literal: true
33

44
module Roast

lib/roast/dsl/execution_context.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# typed: false
1+
# typed: true
22
# frozen_string_literal: true
33

44
module Roast

lib/roast/dsl/executor.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,12 @@ def completed?
5858
@completed ||= false
5959
end
6060

61+
#: { () [self: ConfigContext] -> void} -> void
6162
def config(&block)
6263
@config_proc = block
6364
end
6465

66+
#: { () [self: ExecutionContext] -> void} -> void
6567
def execute(&block)
6668
@execution_proc = block
6769
end
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# typed: true
2+
# frozen_string_literal: true
3+
4+
module Roast
5+
module DSL
6+
class ConfigContext
7+
def cmd(name = nil, &block); end
8+
end
9+
end
10+
end
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# typed: true
2+
# frozen_string_literal: true
3+
4+
module Roast
5+
module DSL
6+
class ExecutionContext
7+
#: (?String?) -> void
8+
def cmd(name = nil, &block); end
9+
end
10+
end
11+
end

0 commit comments

Comments
 (0)