Class: RbsActiverecord::Parser::IncludeExpander::Module

Inherits:
Object
  • Object
show all
Defined in:
lib/rbs_activerecord/parser/include_expander/module.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mod, name) ⇒ Module

Returns a new instance of Module.



12
13
14
15
# File 'lib/rbs_activerecord/parser/include_expander/module.rb', line 12

def initialize(mod, name) #: void
  @mod = mod
  @name = name
end

Instance Attribute Details

#modObject (readonly)

: ::Module



7
8
9
# File 'lib/rbs_activerecord/parser/include_expander/module.rb', line 7

def mod
  @mod
end

#nameObject (readonly)

: String



8
9
10
# File 'lib/rbs_activerecord/parser/include_expander/module.rb', line 8

def name
  @name
end

Instance Method Details

#concern?Boolean

: bool

Returns:

  • (Boolean)


17
18
19
# File 'lib/rbs_activerecord/parser/include_expander/module.rb', line 17

def concern? #: bool
  mod.is_a?(::ActiveSupport::Concern)
end

#included_blocksObject

: Array



21
22
23
24
25
# File 'lib/rbs_activerecord/parser/include_expander/module.rb', line 21

def included_blocks #: Array[Prism::CallNode]
  return [] unless concern?

  declarations.select { |node| node.name == :included }
end