Class: Decode::Language::Generic
- Inherits:
-
Object
- Object
- Decode::Language::Generic
- Defined in:
- lib/decode/language/generic.rb
Overview
The Ruby language.
Direct Known Subclasses
Constant Summary collapse
- EXTENSIONS =
[]
- TAGS =
Comment::Tags.build do || ['attribute'] = Comment::Attribute ['parameter'] = Comment::Parameter ['yields'] = Comment::Yields ['returns'] = Comment::Returns ['raises'] = Comment::Raises ['throws'] = Comment::Throws ['deprecated'] = Comment::Pragma ['asynchronous'] = Comment::Pragma ['public'] = Comment::Pragma ['private'] = Comment::Pragma end
Instance Attribute Summary collapse
-
#extensions ⇒ Object
readonly
Returns the value of attribute extensions.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
-
#definitions_for(source, &block) ⇒ Object
Parse the input yielding definitions.
-
#initialize(name, extensions: self.class::EXTENSIONS, tags: self.class::TAGS) ⇒ Generic
constructor
A new instance of Generic.
- #names ⇒ Object
- #parser ⇒ Object
-
#reference_for(identifier) ⇒ Object
Generate a language-specific reference.
-
#segments_for(source, &block) ⇒ Object
Parse the input yielding segments.
Constructor Details
#initialize(name, extensions: self.class::EXTENSIONS, tags: self.class::TAGS) ⇒ Generic
Returns a new instance of Generic.
31 32 33 34 35 |
# File 'lib/decode/language/generic.rb', line 31 def initialize(name, extensions: self.class::EXTENSIONS, tags: self.class::TAGS) @name = name @extensions = extensions @tags = end |
Instance Attribute Details
#extensions ⇒ Object (readonly)
Returns the value of attribute extensions.
43 44 45 |
# File 'lib/decode/language/generic.rb', line 43 def extensions @extensions end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
37 38 39 |
# File 'lib/decode/language/generic.rb', line 37 def name @name end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
45 46 47 |
# File 'lib/decode/language/generic.rb', line 45 def @tags end |
Instance Method Details
#definitions_for(source, &block) ⇒ Object
Parse the input yielding definitions.
62 63 64 65 66 |
# File 'lib/decode/language/generic.rb', line 62 def definitions_for(source, &block) if parser = self.parser parser.definitions_for(source, &block) end end |
#names ⇒ Object
39 40 41 |
# File 'lib/decode/language/generic.rb', line 39 def names [@name] end |
#parser ⇒ Object
53 54 55 |
# File 'lib/decode/language/generic.rb', line 53 def parser nil end |
#reference_for(identifier) ⇒ Object
Generate a language-specific reference.
49 50 51 |
# File 'lib/decode/language/generic.rb', line 49 def reference_for(identifier) Reference.new(identifier, self) end |
#segments_for(source, &block) ⇒ Object
Parse the input yielding segments. Segments are constructed from a block of top level comments followed by a block of code.
74 75 76 77 78 |
# File 'lib/decode/language/generic.rb', line 74 def segments_for(source, &block) if parser = self.parser parser.segments_for(source, &block) end end |