Class: SourceAnnotationExtractor::Annotation
Relationships & Source Files | |
Inherits: |
Struct
|
Defined in: | railties/lib/rails/source_annotation_extractor.rb |
Class Method Summary
- .directories
- .extensions
-
.register_extensions(*exts, &block)
Registers new Annotations File Extensions.
Instance Attribute Summary
Instance Method Summary
-
#to_s(options = {})
Returns a representation of the annotation that looks like this:
Class Method Details
.directories
[ GitHub ]# File 'railties/lib/rails/source_annotation_extractor.rb', line 17
def self.directories @@directories ||= %w(app config db lib test) + (ENV['SOURCE_ANNOTATION_DIRECTORIES'] || '').split(',') end
.extensions
[ GitHub ]# File 'railties/lib/rails/source_annotation_extractor.rb', line 21
def self.extensions @@extensions ||= {} end
.register_extensions(*exts, &block)
Registers new Annotations File Extensions
SourceAnnotationExtractor::Annotation.register_extensions("css", "scss", "sass", "less", "js") { |tag| /\/\/\s*(#{tag}):?\s*(.*)$/ }
# File 'railties/lib/rails/source_annotation_extractor.rb', line 27
def self.register_extensions(*exts, &block) extensions[/\.(#{exts.join("|")})$/] = block end
Instance Attribute Details
#line (rw)
[ GitHub ]# File 'railties/lib/rails/source_annotation_extractor.rb', line 16
class Annotation < Struct.new(:line, :tag, :text)
#tag (rw)
[ GitHub ]# File 'railties/lib/rails/source_annotation_extractor.rb', line 16
class Annotation < Struct.new(:line, :tag, :text)
#text (rw)
[ GitHub ]# File 'railties/lib/rails/source_annotation_extractor.rb', line 16
class Annotation < Struct.new(:line, :tag, :text)
Instance Method Details
#to_s(options = {})
Returns a representation of the annotation that looks like this:
[126] [TODO] This algorithm is simple and clearly correct, make it faster.
If options
has a flag :tag
the tag is shown as in the example above. Otherwise the string contains just line and text.