Module: CommentExtractor::Extractor::Concerns::SimpleExtractor

Includes:
CodeObject::Comment::Type
Included in:
CommentExtractor::Extractor::Clojure, CommentExtractor::Extractor::Coffee, SlashExtractor, Erlang, Fortran, Haskell, Html, JavaScript, Lisp, Lua, Perl, Python, Shell, Sql, Tex, Text, Yaml
Defined in:
lib/comment_extractor/extractor/concerns/simple_extractor.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary

Constants included from CodeObject::Comment::Type

CodeObject::Comment::Type::BLOCK_COMMENT, CodeObject::Comment::Type::ONE_LINER_COMMENT

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.attr_definition(*keys) ⇒ Object


14
15
16
17
18
19
20
# File 'lib/comment_extractor/extractor/concerns/simple_extractor.rb', line 14

def self.attr_definition(*keys)
  keys.each do |key|
    define_method key do
      self.class.instance_variable_get("@#{key}") || []
    end
  end
end

.included(k) ⇒ Object


8
9
10
11
12
# File 'lib/comment_extractor/extractor/concerns/simple_extractor.rb', line 8

def self.included(k)
  k.class_eval do |klass|
    extend ClassMethods
  end
end

Instance Method Details

#scanObject


95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/comment_extractor/extractor/concerns/simple_extractor.rb', line 95

def scan
  until scanner.eos?
    case
    when scan_ignore_patterns
      next
    when scan_complicate_conditions
      next
    when scan_comment
      next
    when scan_bracket
      next
    when scanner.scan(CommentExtractor::Extractor::REGEXP[:BREAK])
      next
    when scanner.scan(/./)
      next
    else
      raise_report
    end
  end
end