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`.=, #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)


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

def container?
  true
end

#coverage_relevant?Boolean

Coverage is not relevant for singleton classes.

Returns:

  • (Boolean)


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

def coverage_relevant?
  false
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

#nested_nameObject

Generate a nested name for the singleton class.



56
57
58
# File 'lib/decode/language/ruby/class.rb', line 56

def nested_name
  "class"
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 << #{self.name}"
end