Class: Decode::Language::Ruby::Singleton
- Inherits:
-
Definition
- Object
- Definition
- Decode::Language::Ruby::Singleton
- 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
-
#container? ⇒ Boolean
A singleton class is a container for other definitions.
-
#nested? ⇒ Boolean
Typically, a singleton class does not contain other definitions.
- #nested_name ⇒ Object
-
#path ⇒ Object
The lexical scope as an array of names.
- #path_name ⇒ Object
-
#short_form ⇒ Object
(also: #long_form)
The short form of the class.
Methods inherited from Definition
#convert, #documentation, #initialize, #inspect, #location, #multiline?, #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.
63 64 65 |
# File 'lib/decode/language/ruby/class.rb', line 63 def container? true end |
#nested? ⇒ Boolean
Typically, a singleton class does not contain other definitions.
69 70 71 |
# File 'lib/decode/language/ruby/class.rb', line 69 def nested? false end |
#nested_name ⇒ Object
57 58 59 |
# File 'lib/decode/language/ruby/class.rb', line 57 def nested_name "::class" end |
#path ⇒ Object
The lexical scope as an array of names. e.g. ‘[:Decode, :Definition]`
89 90 91 92 93 94 95 96 |
# File 'lib/decode/language/ruby/class.rb', line 89 def path if @path # Cached version: @path else @path = [*self.absolute_path, *self.path_name] end end |
#path_name ⇒ Object
82 83 84 |
# File 'lib/decode/language/ruby/class.rb', line 82 def path_name [:class] end |
#short_form ⇒ Object Also known as: long_form
The short form of the class. e.g. ‘class << self`.
75 76 77 |
# File 'lib/decode/language/ruby/class.rb', line 75 def short_form "class << #{@name}" end |