Class: Decode::Definition

Inherits:
Symbol
  • Object
show all
Defined in:
lib/decode/symbol.rb

Instance Attribute Summary collapse

Attributes inherited from Symbol

#kind, #language, #name, #parent

Instance Method Summary collapse

Methods inherited from Symbol

#inspect, #key, #lexical_path, #path, #qualified_name

Constructor Details

#initialize(kind, name, node, comments, **options) ⇒ Definition

Returns a new instance of Definition.



70
71
72
73
74
75
76
# File 'lib/decode/symbol.rb', line 70

def initialize(kind, name, node, comments, **options)
	super(kind, name, **options)
	
	@node = node
	@comments = comments
	@documentation = nil
end

Instance Attribute Details

#commentsObject (readonly)

Returns the value of attribute comments.



82
83
84
# File 'lib/decode/symbol.rb', line 82

def comments
  @comments
end

Instance Method Details

#documentationObject



84
85
86
87
88
# File 'lib/decode/symbol.rb', line 84

def documentation
	if @comments.any?
		@documentation ||= Documentation.new(@comments)
	end
end

#textObject



78
79
80
# File 'lib/decode/symbol.rb', line 78

def text
	@node.location.expression.source
end