class Solargraph::Parser::Rubyvm::NodeProcessors::DefsNode
Public Instance Methods
process()
click to toggle source
# File lib/solargraph/parser/rubyvm/node_processors/defs_node.rb, line 10 def process s_visi = region.visibility s_visi = :public if region.scope != :class loc = get_node_location(node) anon_splat = node_has_anon_splat? if node.children[0].is_a?(RubyVM::AbstractSyntaxTree::Node) && node.children[0].type == :SELF closure = region.closure else closure = Solargraph::Pin::Namespace.new( name: unpack_name(node.children[0]) ) end if s_visi == :module_function pins.push Solargraph::Pin::Method.new( location: loc, closure: closure, name: node.children[1].to_s, comments: comments_for(node), scope: :class, visibility: :public, node: node, anon_splat: anon_splat ) pins.push Solargraph::Pin::Method.new( location: loc, closure: closure, name: node.children[1].to_s, comments: comments_for(node), scope: :instance, visibility: :private, node: node, anon_splat: anon_splat ) else pins.push Solargraph::Pin::Method.new( location: loc, closure: closure, name: node.children[1].to_s, comments: comments_for(node), scope: :class, visibility: s_visi, node: node, anon_splat: anon_splat ) end process_children region.update(closure: pins.last, scope: :class) end
Private Instance Methods
node_has_anon_splat?()
click to toggle source
# File lib/solargraph/parser/rubyvm/node_processors/defs_node.rb, line 61 def node_has_anon_splat? node.children[2]&.children&.first == [nil] end