This repository has been archived by the owner on Nov 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
448 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
--- | ||
language: ruby | ||
rvm: | ||
- 2.4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
class Signatures | ||
# comment sig_void | ||
sig {void} | ||
def sig_void; end | ||
|
||
# comment sig_override_void | ||
sig.override.void | ||
def sig_override_void; end | ||
|
||
# comment sig_arguments | ||
sig {params(a: Integer, b: Integer).void} | ||
def sig_arguments(a, b); end | ||
|
||
# comment sig_multiline_arguments | ||
sig do | ||
params( | ||
a: Integer, | ||
b: Integer, | ||
).void | ||
end | ||
def sig_multiline_arguments(a, b); end | ||
|
||
# comment sig_multiline_comments | ||
# comment sig_multiline_comments | ||
sig {void} | ||
def sig_multiline_comments; end | ||
|
||
# comment sig_class_method | ||
sig {void} | ||
def self.sig_class_method; end | ||
|
||
class << self | ||
# comment reopening | ||
sig {void} | ||
def reopening; end | ||
end | ||
|
||
# At end of class | ||
sig {void} | ||
end | ||
|
||
class Subclass < Signatures | ||
# with subclass | ||
sig {void} | ||
def method; end | ||
end | ||
|
||
class ClassWithCode | ||
# bar | ||
sig {void} | ||
def bar; end | ||
|
||
puts 'foobar' | ||
|
||
# foo | ||
sig {void} | ||
def foo; end | ||
end | ||
|
||
class Outer | ||
# outer method | ||
sig {void} | ||
def outer; end | ||
|
||
class Inner | ||
# inner method | ||
sig {void} | ||
def inner; end | ||
end | ||
|
||
# outer method 2 | ||
sig {void} | ||
def outer2; end | ||
end | ||
|
||
module Module | ||
# module function | ||
sig {void} | ||
def self.foo; end | ||
|
||
# module instance method | ||
sig {void} | ||
def bar; end | ||
end | ||
|
||
class SigReturn | ||
sig {returns(Integer)} | ||
def one; 1; end | ||
|
||
# @deprecated do not use | ||
sig {returns(Integer)} | ||
def two; 2; end | ||
|
||
# @return [Numeric] | ||
sig {returns(Integer)} | ||
def three; 3; end | ||
|
||
# @return the number four | ||
sig {returns(Integer)} | ||
def four; 4; end | ||
|
||
sig {params(int: Integer).returns(Float)} | ||
def plus_one(int); int + 1.0; end | ||
|
||
sig {returns(T.any(Numeric, String))} | ||
def plus(a, b); a + b; end | ||
|
||
sig {void} | ||
def void_method; end | ||
end | ||
|
||
class SigAbstract | ||
sig {abstract} | ||
def one; end | ||
|
||
# @abstract subclass must implement | ||
sig {abstract} | ||
def two; end | ||
|
||
sig {abstract.returns(Boolean)} | ||
def with_return; true; end | ||
|
||
sig {abstract.void} | ||
def with_void; end | ||
end | ||
|
||
class SigParams | ||
# @param bar the thing | ||
# @param baz [Object] the other thing | ||
sig {params(bar: T.any(String, Symbol), baz: T.nilable(String)).void} | ||
def foo(bar, baz); end | ||
|
||
sig do | ||
params( | ||
blk: T.proc.params(arg0: String).returns(T::Array[Hash]) | ||
) | ||
.returns(NilClass) | ||
end | ||
def blk_method(&blk); nil; end | ||
|
||
sig do | ||
override | ||
.params(block: T.proc.params( | ||
model: EmailConversation, | ||
mutator: T.untyped, | ||
).void) | ||
.void | ||
end | ||
def impl_blk_method(&block); end | ||
end | ||
|
||
class CollectionSigs | ||
sig {params(arr: T::Array[String]).void} | ||
def collection(arr); end | ||
|
||
sig {params(arr: T::Array[T::Array[String]]).void} | ||
def nested_collection(arr); end | ||
|
||
sig {params(arr: T::Array[T.any(String, Symbol)]).returns(TrueClass)} | ||
def mixed_collection(arr); true; end | ||
|
||
sig {returns(T::Hash[String, Symbol])} | ||
def hash_method; end | ||
|
||
sig {returns([String, Integer])} | ||
def fixed_array; ['', 0]; end | ||
|
||
# @!visibility protected | ||
sig {returns({foo: T.nilable(String)})} | ||
def fixed_hash; {foo: nil}; end | ||
|
||
sig do | ||
params( | ||
tos_acceptance: T.nilable({ | ||
date: Integer, | ||
ip: String, | ||
user_agent: T.nilable(String), | ||
signator: T.nilable(String), | ||
iovation_blackbox: T.nilable(String), | ||
}) | ||
) | ||
.returns(NilClass) | ||
end | ||
def fixed_param_hash(tos_acceptance); nil; end | ||
end | ||
|
||
class AttrSigs | ||
sig {returns(String)} | ||
attr_accessor :my_accessor | ||
|
||
sig {returns(Integer)} | ||
attr_reader :my_reader | ||
|
||
sig {params(my_writer: T.nilable(Symbol)).returns(T.nilable(Symbol))} | ||
attr_writer :my_writer | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.