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, parent) ⇒ CharSourceDebug
constructor
A new instance of CharSourceDebug.
- #method_missing(methodname, *args) ⇒ Object
Constructor Details
#initialize(s, parent) ⇒ CharSourceDebug
Returns a new instance of CharSourceDebug.
235 236 237 238 |
# File 'lib/maruku/input/charsource.rb', line 235 def initialize(s, parent) @a = CharSourceManual.new(s, parent) @b = CharSourceStrscan.new(s, parent) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(methodname, *args) ⇒ Object
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
# File 'lib/maruku/input/charsource.rb', line 240 def method_missing(methodname, *args) a_bef = @a.describe b_bef = @b.describe a = @a.send(methodname, *args) b = @b.send(methodname, *args) 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 |