class Decode::Language::Generic

The Ruby language.

Constants

EXTENSIONS
TAGS

Attributes

extensions[R]
name[R]
tags[R]

Public Class Methods

new(name, extensions: self.class::EXTENSIONS, tags: self.class::TAGS) click to toggle source
# File lib/decode/language/generic.rb, line 46
def initialize(name, extensions: self.class::EXTENSIONS, tags: self.class::TAGS)
        @name = name
        @extensions = extensions
        @tags = tags
end

Public Instance Methods

definitions_for(input, &block) click to toggle source

Parse the input yielding definitions. @parameter input [File] The input 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.

# File lib/decode/language/generic.rb, line 77
def definitions_for(input, &block)
        if parser = self.parser
                parser.definitions_for(input, &block)
        end
end
names() click to toggle source
# File lib/decode/language/generic.rb, line 54
def names
        [@name]
end
parser() click to toggle source
# File lib/decode/language/generic.rb, line 68
def parser
        nil
end
reference_for(identifier) click to toggle source

Generate a language-specific reference. @parameter identifier [String] A valid identifier.

# File lib/decode/language/generic.rb, line 64
def reference_for(identifier)
        Reference.new(identifier, self)
end
segments_for(input, &block) click to toggle source

Parse the input yielding segments. Segments are constructed from a block of top level comments followed by a block of code. @parameter input [File] The input file which contains the source code. @yields {|segment| …}

@parameter segment [Segment]

@returns [Enumerator(Segment)] If no block given.

# File lib/decode/language/generic.rb, line 89
def segments_for(input, &block)
        if parser = self.parser
                parser.segments_for(input, &block)
        end
end