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

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

Overview

A Ruby-specific singleton class.

Instance Attribute Summary

Attributes inherited from Definition

#comments

Attributes inherited from Symbol

#kind, #language, #name, #parent

Instance Method Summary collapse

Methods inherited from Definition

#documentation, #initialize, #multiline?, #qualified_form, #text

Methods inherited from Symbol

#initialize, #inspect, #key, #lexical_path, #path, #qualified_name

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)


62
63
64
# File 'lib/decode/language/ruby/class.rb', line 62

def container?
	true
end

#nested?Boolean

Typically, a singleton class does not contain other definitions.

Returns:

  • (Boolean)


68
69
70
# File 'lib/decode/language/ruby/class.rb', line 68

def nested?
	false
end

#short_formObject Also known as: long_form

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



74
75
76
# File 'lib/decode/language/ruby/class.rb', line 74

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