Decode SourceDecodeLanguageRubyConstant

class Constant

A Ruby-specific constant.

Definitions

def short_form

The short form of the constant. e.g. NAME.

Implementation

def short_form
	@node.location.name.source
end

def long_form

The long form of the constant. e.g. NAME = "Alice".

Implementation

def long_form
	if @node.location.line == @node.location.last_line
		@node.location.expression.source
	elsif @node.children[2].type == :array
		"#{@name} = [...]"
	elsif @node.children[2].type == :hash
		"#{@name} = {...}"
	else
		self.short_form
	end
end