Sha256: b5eb610511f136328e8f13460d21de050fa1014a3d1e4367d9327423bc4ce1d2
Contents?: true
Size: 928 Bytes
Versions: 3
Compression:
Stored size: 928 Bytes
Contents
module Analyst module Entities class Module < Entity def name const_node_array(name_node).join('::') end def full_name parent.full_name.empty? ? name : parent.full_name + '::' + name end private def name_node ast.children.first end # takes a (const) node and returns an array specifying the fully-qualified # constant name that it represents. ya know, so CoolModule::SubMod::SweetClass # would be parsed to: # (const # (const # (const nil :CoolModule) :SubMod) :SweetClass) # and passing that node here would return [:CoolModule, :SubMod, :SweetClass] def const_node_array(node) return [] if node.nil? raise "expected (const) node or nil, got (#{node.type})" unless node.type == :const const_node_array(node.children.first) << node.children[1] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
analyst-0.14.2 | lib/analyst/entities/module.rb |
analyst-0.14.1 | lib/analyst/entities/module.rb |
analyst-0.14.0 | lib/analyst/entities/module.rb |