Class: Decode::Language::Ruby::Module

Inherits:
Definition
  • Object
show all
Defined in:
lib/decode/language/ruby/module.rb

Overview

A Ruby-specific module.

Instance Attribute Summary

Attributes inherited from Definition

#comments, #language, #name, #parent

Instance Method Summary collapse

Methods inherited from Definition

#convert, #documentation, #initialize, #inspect, #location, #multiline?, #nested?, #path, #qualified_name, #start_with?, #text

Constructor Details

This class inherits a constructor from Decode::Definition

Instance Method Details

#container?Boolean

A module is a container for other definitions.

Returns:

  • (Boolean)


14
15
16
# File 'lib/decode/language/ruby/module.rb', line 14

def container?
	true
end

#long_formObject



28
29
30
# File 'lib/decode/language/ruby/module.rb', line 28

def long_form
	qualified_form
end

#nested_nameObject



18
19
20
# File 'lib/decode/language/ruby/module.rb', line 18

def nested_name
	"::#{name}"
end

#path_nameObject



38
39
40
# File 'lib/decode/language/ruby/module.rb', line 38

def path_name
	@name.to_s.split('::').map(&:to_sym)
end

#qualified_formObject

The fully qualified name of the class. e.g. ‘module ::Barnyard::Dog`.



34
35
36
# File 'lib/decode/language/ruby/module.rb', line 34

def qualified_form
	"module #{self.qualified_name}"
end

#short_formObject

The short form of the module. e.g. ‘module Barnyard`.



24
25
26
# File 'lib/decode/language/ruby/module.rb', line 24

def short_form
	"module #{path_name.last}"
end