Module: Gammo::Tokenizer::Debug::ClassMethods

Defined in:
lib/gammo/tokenizer/debug.rb

Instance Method Summary collapse

Instance Method Details

#mapObject



28
29
30
# File 'lib/gammo/tokenizer/debug.rb', line 28

def map
  @map ||= {}
end

#method_added(method) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/gammo/tokenizer/debug.rb', line 13

def method_added(method)
  name = method.to_s
  return if %w[debug _debugged ?].any?(&name.method(:end_with?))
  return unless name.start_with?('scan_')
  return if map[method]
  map[method] = true
  alias_method :"#{name}_debugged", method
  class_eval "    def \#{method}\n      debug \"\#{method}, \\\#{scanner.string[scanner.pos]}\"\n      \#{method}_debugged\n    end\n  EOS\nend\n"