class JsDuck::ClassName
Common routines for manipulating class names.
Public Class Methods
short(name)
click to toggle source
Given a full class name extracts the “class”-part of the name.
ClassName.short("My.package.Foo") --> "Foo"
Because we try to emulate ext-doc, it's not as simple as just taking the last part. See class_spec.rb for details.
# File lib/jsduck/class_name.rb, line 12 def self.short(name) parts = name.split(/\./) short = parts.pop while parts.length > 1 && parts.last =~ /^[A-Z]/ short = parts.pop + "." + short end short end