Class: RBS::Trace::Definition
- Inherits:
-
Object
- Object
- RBS::Trace::Definition
- Defined in:
- lib/rbs/trace/definition.rb
Instance Attribute Summary collapse
-
#klass ⇒ Object
readonly
: Class.
-
#lineno ⇒ Object
readonly
: Integer.
-
#name ⇒ Object
readonly
: Symbol.
Instance Method Summary collapse
- #decls ⇒ Object
-
#initialize(klass:, name:, lineno:) ⇒ Definition
constructor
A new instance of Definition.
- #rbs ⇒ Object
- #rbs_comment(indent = 0) ⇒ Object
Constructor Details
#initialize(klass:, name:, lineno:) ⇒ Definition
Returns a new instance of Definition.
11 12 13 14 15 |
# File 'lib/rbs/trace/definition.rb', line 11 def initialize(klass:, name:, lineno:) @klass = klass @name = name @lineno = lineno end |
Instance Attribute Details
#klass ⇒ Object (readonly)
: Class
6 7 8 |
# File 'lib/rbs/trace/definition.rb', line 6 def klass @klass end |
#lineno ⇒ Object (readonly)
: Integer
8 9 10 |
# File 'lib/rbs/trace/definition.rb', line 8 def lineno @lineno end |
#name ⇒ Object (readonly)
: Symbol
7 8 9 |
# File 'lib/rbs/trace/definition.rb', line 7 def name @name end |
Instance Method Details
#decls ⇒ Object
18 19 20 |
# File 'lib/rbs/trace/definition.rb', line 18 def decls @decls ||= [] end |
#rbs ⇒ Object
28 29 30 |
# File 'lib/rbs/trace/definition.rb', line 28 def rbs @decls.inject { |result, decl| result.merge(decl) }.to_rbs end |
#rbs_comment(indent = 0) ⇒ Object
23 24 25 |
# File 'lib/rbs/trace/definition.rb', line 23 def rbs_comment(indent = 0) "#{" " * indent}# @rbs #{rbs}\n" end |