Class: Decode::Language::Ruby::Class
- Inherits:
-
Definition
- Object
- Definition
- Decode::Language::Ruby::Class
- Defined in:
- lib/decode/language/ruby/class.rb
Overview
A Ruby-specific class.
Instance Attribute Summary collapse
-
#super_class ⇒ Object
readonly
Returns the value of attribute super_class.
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
-
#container? ⇒ Boolean
A class is a container for other definitions.
-
#initialize(*arguments, super_class: nil, **options) ⇒ Class
constructor
Initialize a new class definition.
-
#long_form ⇒ Object
The long form of the class.
-
#qualified_form ⇒ Object
The fully qualified name of the class.
-
#short_form ⇒ Object
The short form of the class.
Methods inherited from Definition
#:public, :private, :protected=, #The parent definition, defining lexical scope.=, #The symbol name e.g. `:Decode`.=, #convert, #coverage_relevant?, #documentation, #documented?, #full_path, #inspect, #location, #multiline?, #name, #nested?, #nested_name, #public?, #qualified_name, #start_with?, #text
Constructor Details
#initialize(*arguments, super_class: nil, **options) ⇒ Class
Initialize a new class definition.
17 18 19 20 21 |
# File 'lib/decode/language/ruby/class.rb', line 17 def initialize(*arguments, super_class: nil, **) super(*arguments, **) @super_class = super_class end |
Instance Attribute Details
#super_class ⇒ Object (readonly)
Returns the value of attribute super_class.
23 24 25 |
# File 'lib/decode/language/ruby/class.rb', line 23 def super_class @super_class end |
Instance Method Details
#container? ⇒ Boolean
A class is a container for other definitions.
26 27 28 |
# File 'lib/decode/language/ruby/class.rb', line 26 def container? true end |
#long_form ⇒ Object
The long form of the class. e.g. ‘class Dog < Animal`.
38 39 40 41 42 43 44 |
# File 'lib/decode/language/ruby/class.rb', line 38 def long_form if super_class = self.super_class "#{qualified_form} < #{super_class}" else qualified_form end end |
#qualified_form ⇒ Object
The fully qualified name of the class. e.g. ‘class ::Barnyard::Dog`.
48 49 50 |
# File 'lib/decode/language/ruby/class.rb', line 48 def qualified_form "class #{self.qualified_name}" end |
#short_form ⇒ Object
The short form of the class. e.g. ‘class Animal`.
32 33 34 |
# File 'lib/decode/language/ruby/class.rb', line 32 def short_form "class #{self.name}" end |