Module: Decode::Language::Ruby

Defined in:
lib/decode/language/ruby.rb,
lib/decode/language/ruby/call.rb,
lib/decode/language/ruby/block.rb,
lib/decode/language/ruby/class.rb,
lib/decode/language/ruby/method.rb,
lib/decode/language/ruby/module.rb,
lib/decode/language/ruby/parser.rb,
lib/decode/language/ruby/segment.rb,
lib/decode/language/ruby/constant.rb,
lib/decode/language/ruby/function.rb,
lib/decode/language/ruby/attribute.rb,
lib/decode/language/ruby/reference.rb,
lib/decode/language/ruby/definition.rb

Overview

An interface for extracting information from Ruby source code.

Defined Under Namespace

Classes: Attribute, Block, Call, Class, Constant, Definition, Function, Method, Module, Parser, Reference, Segment, Singleton

Constant Summary collapse

TAGS =
Comment::Tags.build do |tags|
	tags['attribute'] = Comment::Attribute
	tags['parameter'] = Comment::Parameter
	tags['yields'] = Comment::Yields
	tags['returns'] = Comment::Returns
	tags['raises'] = Comment::Raises
	tags['throws'] = Comment::Throws
	
	tags['reentrant'] = Comment::Pragma
	tags['deprecated'] = Comment::Pragma
	tags['blocking'] = Comment::Pragma
	tags['asynchronous'] = Comment::Pragma
end

Class Method Summary collapse

Class Method Details

.definitions_for(input, &block) ⇒ Object

Parse the input yielding definitions.



76
77
78
# File 'lib/decode/language/ruby.rb', line 76

def self.definitions_for(input, &block)
	Parser.new.definitions_for(input, &block)
end

.extensionsObject



43
44
45
# File 'lib/decode/language/ruby.rb', line 43

def self.extensions
	['.rb', '.ru']
end

.nameObject

The canoical name of the language for use in output formatting. e.g. source code highlighting.



35
36
37
# File 'lib/decode/language/ruby.rb', line 35

def self.name
	"ruby"
end

.namesObject



39
40
41
# File 'lib/decode/language/ruby.rb', line 39

def self.names
	[self.name]
end

.reference_for(identifier) ⇒ Object

Generate a language-specific reference.



67
68
69
# File 'lib/decode/language/ruby.rb', line 67

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

.segments_for(input, &block) ⇒ Object

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



86
87
88
# File 'lib/decode/language/ruby.rb', line 86

def self.segments_for(input, &block)
	Parser.new.segments_for(input, &block)
end

.tagsObject



61
62
63
# File 'lib/decode/language/ruby.rb', line 61

def self.tags
	TAGS
end