Class: Decode::Language::Ruby::Generic

Inherits:
Generic
  • Object
show all
Defined in:
lib/decode/language/ruby/generic.rb

Overview

Represents the Ruby language implementation for parsing and analysis.

Constant Summary collapse

EXTENSIONS =
[".rb", ".ru"]
TAGS =
Comment::Tags.build do |tags|
	tags["attribute"] = Comment::Attribute
	tags["constant"] = Comment::Constant
	tags["parameter"] = Comment::Parameter
	tags["option"] = Comment::Option
	tags["yields"] = Comment::Yields
	tags["returns"] = Comment::Returns
	tags["raises"] = Comment::Raises
	tags["throws"] = Comment::Throws
	
	tags["deprecated"] = Comment::Pragma
	
	tags["asynchronous"] = Comment::Pragma
	
	tags["public"] = Comment::Pragma
	tags["private"] = Comment::Pragma
	
	tags["example"] = Comment::Example
	
	tags["rbs"] = Comment::RBS
end

Instance Attribute Summary

Attributes inherited from Generic

#The language name., #The supported file extensions., #extensions, #name, #tags

Instance Method Summary collapse

Methods inherited from Generic

#The tag definitions.=, #definitions_for, #initialize, #names, #segments_for

Constructor Details

This class inherits a constructor from Decode::Language::Generic

Instance Method Details

#code_for(text, index, relative_to: nil) ⇒ Object

Generate a code representation with syntax highlighting and link resolution.



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

def code_for(text, index, relative_to: nil)
	Code.new(text, index, relative_to: relative_to, language: self)
end

#parserObject

Get the parser for Ruby source code.



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

def parser
	@parser ||= Parser.new(self)
end

#reference_for(identifier) ⇒ Object

Generate a language-specific reference for Ruby.



51
52
53
# File 'lib/decode/language/ruby/generic.rb', line 51

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