Class: MaRuKu::In::Markdown::SpanLevelParser::CharSourceDebug
- Inherits:
-
Object
- Object
- MaRuKu::In::Markdown::SpanLevelParser::CharSourceDebug
- Defined in:
- lib/maruku/input/charsource.rb,
lib/maruku/input/charsource.rb
Overview
A debug scanner that checks the correctness of both by comparing their output
Instance Method Summary collapse
-
#initialize(s) ⇒ CharSourceDebug
constructor
A new instance of CharSourceDebug.
- #method_missing(methodname, *args) ⇒ Object
Constructor Details
#initialize(s) ⇒ CharSourceDebug
Returns a new instance of CharSourceDebug.
270 271 272 273 |
# File 'lib/maruku/input/charsource.rb', line 270 def initialize(s) @a = CharSourceManual.new(s) @b = CharSourceStrscan.new(s) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(methodname, *args) ⇒ Object
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
# File 'lib/maruku/input/charsource.rb', line 275 def method_missing(methodname, *args) a_bef = @a.describe b_bef = @b.describe a = @a.send(methodname, *args) b = @b.send(methodname, *args) # if methodname == :describe # return a # end if a.kind_of? MatchData if a.to_a != b.to_a puts "called: #{methodname}(#{args})" puts "Matchdata:\na = #{a.to_a.inspect}\nb = #{b.to_a.inspect}" puts "AFTER: "+@a.describe puts "AFTER: "+@b.describe puts "BEFORE: "+a_bef puts "BEFORE: "+b_bef puts caller.join("\n") exit end else if a!=b puts "called: #{methodname}(#{args})" puts "Attenzione!\na = #{a.inspect}\nb = #{b.inspect}" puts ""+@a.describe puts ""+@b.describe puts caller.join("\n") exit end end if @a.cur_char != @b.cur_char puts "Fuori sincronia dopo #{methodname}(#{args})" puts ""+@a.describe puts ""+@b.describe exit end return a end |