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`, and `extend` method.
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.
358 359 360 361 362 363 364 |
# File 'lib/rbs/inline/ast/members.rb', line 358 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
352 353 354 |
# File 'lib/rbs/inline/ast/members.rb', line 352 def application @application end |
#comments ⇒ Object (readonly)
Comments attached to the call node
349 350 351 |
# File 'lib/rbs/inline/ast/members.rb', line 349 def comments @comments end |
#node ⇒ Object (readonly)
CallNode that calls ‘include`, `prepend`, and `extend` method
346 347 348 |
# File 'lib/rbs/inline/ast/members.rb', line 346 def node @node end |
Instance Method Details
#rbs ⇒ Object
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 406 407 408 409 410 411 |
# File 'lib/rbs/inline/ast/members.rb', line 370 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 |