Class: JsDuck::ClassNameString

Inherits:
String
  • Object
show all
Defined in:
lib/jsduck/class.rb

Overview

String class for classnames that has extra method #exists? which returns false when class with such name doesn’t exist.

This ability is used by JsDuck::Renderer, which only receives names of various classes but needs to only render existing classes as links.

Instance Method Summary collapse

Constructor Details

#initialize(str, exists = true) ⇒ ClassNameString

Returns a new instance of ClassNameString.



208
209
210
211
# File 'lib/jsduck/class.rb', line 208

def initialize(str, exists=true)
  super(str)
  @exists = exists
end

Instance Method Details

#exists?Boolean

Returns:

  • (Boolean)


213
214
215
# File 'lib/jsduck/class.rb', line 213

def exists?
  @exists
end