Decode SourceDecodeLanguageGeneric

class Generic

The Ruby language.

Definitions

def reference_for(identifier)

Generate a language-specific reference.

Signature

parameter identifier String

A valid identifier.

Implementation

def reference_for(identifier)
	Reference.new(identifier, self)
end

def definitions_for(source, &block)

Parse the input yielding definitions.

Signature

parameter source Source

The input source file which contains the source code.

yields {|definition| ...}

Receives the definitions extracted from the source code.

parameter definition Definition

The source code definition including methods, classes, etc.

returns Enumerator(Segment)

If no block given.

Implementation

def definitions_for(source, &block)
	if parser = self.parser
		parser.definitions_for(source, &block)
	end
end

def segments_for(source, &block)

Parse the input yielding segments. Segments are constructed from a block of top level comments followed by a block of code.

Signature

parameter source Source

The input source file which contains the source code.

yields {|segment| ...}
parameter segment Segment
returns Enumerator(Segment)

If no block given.

Implementation

def segments_for(source, &block)
	if parser = self.parser
		parser.segments_for(source, &block)
	end
end