class Prism::ModuleNode
Represents a module declaration involving themodule keyword.
module Foo end^^^^^^^^^^^^^^
Attributes
attr_reader body:StatementsNode |BeginNode | nil
Public Class Methods
Source
# File lib/prism/node.rb, line 13065definitialize(source,node_id,location,flags,locals,module_keyword_loc,constant_path,body,end_keyword_loc,name)@source =source@node_id =node_id@location =location@flags =flags@locals =locals@module_keyword_loc =module_keyword_loc@constant_path =constant_path@body =body@end_keyword_loc =end_keyword_loc@name =nameend
Initialize a newModuleNode node.
Source
# File lib/prism/node.rb, line 13173defself.type:module_nodeend
Return a symbol representation of this node type. SeeNode::type.
Public Instance Methods
Source
# File lib/prism/node.rb, line 13179def===(other)other.is_a?(ModuleNode)&& (locals.length==other.locals.length)&&locals.zip(other.locals).all? {|left,right|left===right }&& (module_keyword_loc.nil?==other.module_keyword_loc.nil?)&& (constant_path===other.constant_path)&& (body===other.body)&& (end_keyword_loc.nil?==other.end_keyword_loc.nil?)&& (name===other.name)end
Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.
Source
# File lib/prism/node.rb, line 13079defaccept(visitor)visitor.visit_module_node(self)end
def accept: (Visitor visitor) -> void
Source
# File lib/prism/node.rb, line 13084defchild_nodes [constant_path,body]end
defchild_nodes: () ->Array
Source
# File lib/prism/node.rb, line 13097defcomment_targets [module_keyword_loc,constant_path,*body,end_keyword_loc]#: Array[Prism::node | Location]end
defcomment_targets: () -> Array[Node | Location]
Source
# File lib/prism/node.rb, line 13089defcompact_child_nodescompact = []#: Array[Prism::node]compact<<constant_pathcompact<<bodyifbodycompactend
defcompact_child_nodes: () ->Array
Source
# File lib/prism/node.rb, line 13102defcopy(node_id:self.node_id,location:self.location,flags:self.flags,locals:self.locals,module_keyword_loc:self.module_keyword_loc,constant_path:self.constant_path,body:self.body,end_keyword_loc:self.end_keyword_loc,name:self.name)ModuleNode.new(source,node_id,location,flags,locals,module_keyword_loc,constant_path,body,end_keyword_loc,name)end
def copy: (?node_id:Integer, ?location:Location, ?flags:Integer, ?locals:Array, ?module_keyword_loc:Location, ?constant_path:ConstantReadNode |ConstantPathNode |MissingNode, ?body:StatementsNode |BeginNode | nil, ?end_keyword_loc:Location, ?name:Symbol) ->ModuleNode
Source
# File lib/prism/node.rb, line 13110defdeconstruct_keys(keys) {node_id:node_id,location:location,locals:locals,module_keyword_loc:module_keyword_loc,constant_path:constant_path,body:body,end_keyword_loc:end_keyword_loc,name:name }end
defdeconstruct_keys: (Array keys) -> { node_id:Integer, location:Location, locals:Array,module_keyword_loc:Location,constant_path:ConstantReadNode |ConstantPathNode |MissingNode, body:StatementsNode |BeginNode | nil,end_keyword_loc:Location, name:Symbol }
Source
# File lib/prism/node.rb, line 13158defend_keywordend_keyword_loc.sliceend
defend_keyword: () ->String
Source
# File lib/prism/node.rb, line 13137defend_keyword_loclocation =@end_keyword_locreturnlocationiflocation.is_a?(Location)@end_keyword_loc =Location.new(source,location>>32,location&0xFFFFFFFF)end
attr_readerend_keyword_loc:Location
Source
# File lib/prism/node.rb, line 13163definspectInspectVisitor.compose(self)end
def inspect ->String
Source
# File lib/prism/node.rb, line 13153defmodule_keywordmodule_keyword_loc.sliceend
defmodule_keyword: () ->String
Source
# File lib/prism/node.rb, line 13118defmodule_keyword_loclocation =@module_keyword_locreturnlocationiflocation.is_a?(Location)@module_keyword_loc =Location.new(source,location>>32,location&0xFFFFFFFF)end
attr_readermodule_keyword_loc:Location
Source
# File lib/prism/node.rb, line 13145defsave_end_keyword_loc(repository)repository.enter(node_id,:end_keyword_loc)end
Save theend_keyword_loc location using the given saved source so that it can be retrieved later.
Source
# File lib/prism/node.rb, line 13126defsave_module_keyword_loc(repository)repository.enter(node_id,:module_keyword_loc)end
Save themodule_keyword_loc location using the given saved source so that it can be retrieved later.