Class: Decode::Language::Ruby::Singleton

Inherits:
Definition
  • Object
show all
Defined in:
lib/decode/language/ruby/class.rb

Overview

A Ruby-specific singleton class.

Instance Attribute Summary

Attributes inherited from Definition

#comments, #language, #name, #parent

Instance Method Summary collapse

Methods inherited from Definition

#convert, #documentation, #initialize, #multiline?, #nested_name, #path, #qualified_form, #qualified_name, #start_with?, #text, #to_s

Constructor Details

This class inherits a constructor from Decode::Definition

Instance Method Details

#container?Boolean

A singleton class is a container for other definitions.

Returns:

  • (Boolean)


66
67
68
# File 'lib/decode/language/ruby/class.rb', line 66

def container?
	true
end

#nested?Boolean

Typically, a singleton class does not contain other definitions.

Returns:

  • (Boolean)


72
73
74
# File 'lib/decode/language/ruby/class.rb', line 72

def nested?
	false
end

#short_formObject Also known as: long_form

The short form of the class. e.g. ‘class << (self)`.



78
79
80
# File 'lib/decode/language/ruby/class.rb', line 78

def short_form
	"class << #{@name}"
end