lib/workato/connector/sdk/dsl.rb in workato-connector-sdk-1.0.1 vs lib/workato/connector/sdk/dsl.rb in workato-connector-sdk-1.0.2
- old
+ new
@@ -1,5 +1,6 @@
+# typed: true
# frozen_string_literal: true
require_relative './block_invocation_refinements'
require_relative './dsl/http'
@@ -25,23 +26,37 @@
include AWS
def sleep(seconds)
::Kernel.sleep(seconds.presence || 0)
end
+
+ def puts(*args)
+ T.unsafe(::Kernel).puts(*args)
+ end
end
class WithDsl
+ extend T::Sig
+
include Global
using BlockInvocationRefinements
- def execute(*args, &block)
- instance_exec(*args, &block)
+ sig { params(connection: Connection, args: T.untyped, block: T.untyped).returns(T.untyped) }
+ def execute(connection, *args, &block)
+ @connection = connection
+ T.unsafe(self).instance_exec(*args, &block)
end
- def self.execute(*args, &block)
- WithDsl.new.execute(*args, &block)
+ sig { params(connection: Connection, args: T.untyped, block: T.untyped).returns(T.untyped) }
+ def self.execute(connection, *args, &block)
+ T.unsafe(WithDsl.new).execute(connection, *args, &block)
end
+
+ private
+
+ sig { returns(Connection) }
+ attr_reader :connection
end
end
end
end
end