Class: MockSuey::TypeChecks::Ruby::SignatureGenerator
- Inherits:
-
Object
- Object
- MockSuey::TypeChecks::Ruby::SignatureGenerator
- Defined in:
- lib/mock_suey/type_checks/ruby.rb
Instance Attribute Summary collapse
-
#constants ⇒ Object
readonly
Returns the value of attribute constants.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#method_calls ⇒ Object
readonly
Returns the value of attribute method_calls.
-
#singleton ⇒ Object
(also: #singleton?)
readonly
Returns the value of attribute singleton.
Instance Method Summary collapse
-
#initialize(klass, method_calls) ⇒ SignatureGenerator
constructor
A new instance of SignatureGenerator.
- #to_rbs ⇒ Object
Constructor Details
#initialize(klass, method_calls) ⇒ SignatureGenerator
Returns a new instance of SignatureGenerator.
21 22 23 24 25 26 |
# File 'lib/mock_suey/type_checks/ruby.rb', line 21 def initialize(klass, method_calls) @klass = klass @singleton = klass.singleton_class? @method_calls = method_calls @constants = Set.new end |
Instance Attribute Details
#constants ⇒ Object (readonly)
Returns the value of attribute constants.
18 19 20 |
# File 'lib/mock_suey/type_checks/ruby.rb', line 18 def constants @constants end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
18 19 20 |
# File 'lib/mock_suey/type_checks/ruby.rb', line 18 def klass @klass end |
#method_calls ⇒ Object (readonly)
Returns the value of attribute method_calls.
18 19 20 |
# File 'lib/mock_suey/type_checks/ruby.rb', line 18 def method_calls @method_calls end |
#singleton ⇒ Object (readonly) Also known as: singleton?
Returns the value of attribute singleton.
18 19 20 |
# File 'lib/mock_suey/type_checks/ruby.rb', line 18 def singleton @singleton end |
Instance Method Details
#to_rbs ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/mock_suey/type_checks/ruby.rb', line 28 def to_rbs [ header, *method_calls.map { |name, calls| method_sig(name, calls) }, ].join("\n") end |