Decode SourceDecodeSegment

class Segment

A chunk of code with an optional preceeding comment block.

# Get the first segment from a source file:
segment = source.segments.first

Definitions

attr :comments

The preceeding comments.

Signature

attribute Array(String)

attr :language

The language of the code attached to this segment.

Signature

attribute Language::Generic

def documentation

An interface for accsssing the documentation of the definition.

Signature

returns Documentation | nil

A class Decode::Documentation instance if this definition has comments.

Implementation

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

def code

The source code trailing the comments.

Signature

returns String | nil

Implementation

def code
end