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
Attributes inherited from Definition
#comments, #language, #name, #parent
Instance Method Summary collapse
-
#container? ⇒ Boolean
A class is a container for other definitions.
-
#long_form ⇒ Object
The long form of the class.
- #nested_name ⇒ Object
-
#qualified_form ⇒ Object
The fully qualified name of the class.
-
#short_form ⇒ Object
The short form of the class.
Methods inherited from Definition
#convert, #documentation, #initialize, #multiline?, #nested?, #path, #qualified_name, #start_with?, #text, #to_s
Constructor Details
This class inherits a constructor from Decode::Definition
Instance Method Details
#container? ⇒ Boolean
A class is a container for other definitions.
29 30 31 |
# File 'lib/decode/language/ruby/class.rb', line 29 def container? true end |
#long_form ⇒ Object
The long form of the class. e.g. ‘class Dog < Animal`.
45 46 47 48 49 50 51 52 53 |
# File 'lib/decode/language/ruby/class.rb', line 45 def long_form if super_node = @node.children[1] @node.location.keyword.join( super_node.location.expression ).source else self.short_form end end |
#nested_name ⇒ Object
33 34 35 |
# File 'lib/decode/language/ruby/class.rb', line 33 def nested_name "::#{name}" end |
#qualified_form ⇒ Object
The fully qualified name of the class. e.g. ‘class ::Barnyard::Dog`.
57 58 59 |
# File 'lib/decode/language/ruby/class.rb', line 57 def qualified_form "class #{self.qualified_name}" end |
#short_form ⇒ Object
The short form of the class. e.g. ‘class Animal`.
39 40 41 |
# File 'lib/decode/language/ruby/class.rb', line 39 def short_form "class #{@name}" end |