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
-
#extends ⇒ Object
readonly
Returns the value of attribute extends.
-
#includes ⇒ Object
readonly
Returns the value of attribute includes.
- #Modules extended into this class (adds singleton methods).(extendedintothis) ⇒ Object readonly
- #Modules included into this class.(includedintothis) ⇒ Object readonly
- #Modules prepended into this class (method lookup precedence).(prependedintothis) ⇒ Object readonly
-
#prepends ⇒ Object
readonly
Returns the value of attribute prepends.
-
#super_class ⇒ Object
readonly
Returns the value of attribute super_class.
- #The super class name.(super) ⇒ Object readonly
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`.=, #alias?, #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 22 23 24 |
# File 'lib/decode/language/ruby/class.rb', line 17 def initialize(*arguments, super_class: nil, **) super(*arguments, **) @super_class = super_class @includes = [] @extends = [] @prepends = [] end |
Instance Attribute Details
#extends ⇒ Object (readonly)
Returns the value of attribute extends.
33 34 35 |
# File 'lib/decode/language/ruby/class.rb', line 33 def extends @extends end |
#includes ⇒ Object (readonly)
Returns the value of attribute includes.
30 31 32 |
# File 'lib/decode/language/ruby/class.rb', line 30 def includes @includes end |
#Modules extended into this class (adds singleton methods).(extendedintothis) ⇒ Object (readonly)
33 |
# File 'lib/decode/language/ruby/class.rb', line 33 attr :extends |
#Modules included into this class.(includedintothis) ⇒ Object (readonly)
30 |
# File 'lib/decode/language/ruby/class.rb', line 30 attr :includes |
#Modules prepended into this class (method lookup precedence).(prependedintothis) ⇒ Object (readonly)
36 |
# File 'lib/decode/language/ruby/class.rb', line 36 attr :prepends |
#prepends ⇒ Object (readonly)
Returns the value of attribute prepends.
36 37 38 |
# File 'lib/decode/language/ruby/class.rb', line 36 def prepends @prepends end |
#super_class ⇒ Object (readonly)
Returns the value of attribute super_class.
27 28 29 |
# File 'lib/decode/language/ruby/class.rb', line 27 def super_class @super_class end |
#The super class name.(super) ⇒ Object (readonly)
27 |
# File 'lib/decode/language/ruby/class.rb', line 27 attr :super_class |
Instance Method Details
#container? ⇒ Boolean
A class is a container for other definitions.
39 40 41 |
# File 'lib/decode/language/ruby/class.rb', line 39 def container? true end |
#long_form ⇒ Object
The long form of the class. e.g. ‘class Dog < Animal`.
51 52 53 54 55 56 57 |
# File 'lib/decode/language/ruby/class.rb', line 51 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`.
61 62 63 |
# File 'lib/decode/language/ruby/class.rb', line 61 def qualified_form "class #{self.qualified_name}" end |
#short_form ⇒ Object
The short form of the class. e.g. ‘class Animal`.
45 46 47 |
# File 'lib/decode/language/ruby/class.rb', line 45 def short_form "class #{self.name}" end |