Class: RBS::Inline::AST::Members::RubyMixin
- Includes:
- Declarations::ConstantUtil
- Defined in:
- lib/rbs/inline/ast/members.rb
Instance Attribute Summary collapse
-
#application ⇒ Object
readonly
Possible following type application annotation.
-
#comments ⇒ Object
readonly
Comments attached to the call node.
-
#node ⇒ Object
readonly
CallNode that calls
include,prepend, andextendmethod.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(node, comments, application) ⇒ RubyMixin
constructor
A new instance of RubyMixin.
- #rbs ⇒ Object
Methods included from Declarations::ConstantUtil
Methods inherited from Base
Constructor Details
#initialize(node, comments, application) ⇒ RubyMixin
Returns a new instance of RubyMixin.
352 353 354 355 356 357 358 |
# File 'lib/rbs/inline/ast/members.rb', line 352 def initialize(node, comments, application) super(node.location) @node = node @comments = comments @application = application end |
Instance Attribute Details
#application ⇒ Object (readonly)
Possible following type application annotation
346 347 348 |
# File 'lib/rbs/inline/ast/members.rb', line 346 def application @application end |
#comments ⇒ Object (readonly)
Comments attached to the call node
343 344 345 |
# File 'lib/rbs/inline/ast/members.rb', line 343 def comments @comments end |
#node ⇒ Object (readonly)
CallNode that calls include, prepend, and extend method
340 341 342 |
# File 'lib/rbs/inline/ast/members.rb', line 340 def node @node end |
Instance Method Details
#rbs ⇒ Object
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
# File 'lib/rbs/inline/ast/members.rb', line 364 def rbs return unless node.arguments return unless node.arguments.arguments.size == 1 arg = node.arguments.arguments[0] || raise type_name = type_name(arg) return unless type_name args = [] #: Array[Types::t] if application if application.types args.concat(application.types) end end case node.name when :include RBS::AST::Members::Include.new( name: type_name, args: args, annotations: [], location: nil, comment: nil ) when :extend RBS::AST::Members::Extend.new( name: type_name, args: args, annotations: [], location: nil, comment: nil ) when :prepend RBS::AST::Members::Prepend.new( name: type_name, args: args, annotations: [], location: nil, comment: nil ) end end |