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

#The comment lines which directly preceeded the definition., #The language the symbol is defined within., #The path to the definition, relative to the parent., #The source file containing this definition., #comments, #language, #parent, #path, #source, #visibility

Instance Method Summary collapse

Methods inherited from Definition

#:public, :private, :protected=, #The parent definition, defining lexical scope.=, #The symbol name e.g. `:Decode`.=, #alias?, #convert, #documentation, #documented?, #full_path, #initialize, #inspect, #location, #multiline?, #name, #public?, #qualified_form, #qualified_name, #start_with?, #text

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)


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

def container?
	true
end

#coverage_relevant?Boolean

Coverage is not relevant for singleton classes.

Returns:

  • (Boolean)


95
96
97
# File 'lib/decode/language/ruby/class.rb', line 95

def coverage_relevant?
	false
end

#nested?Boolean

Typically, a singleton class does not contain other definitions.

Returns:

  • (Boolean)


81
82
83
# File 'lib/decode/language/ruby/class.rb', line 81

def nested?
	false
end

#nested_nameObject

Generate a nested name for the singleton class.



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

def nested_name
	"class"
end

#short_formObject Also known as: long_form

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



87
88
89
# File 'lib/decode/language/ruby/class.rb', line 87

def short_form
	"class << #{self.name}"
end