rubybreaker 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/NEWS +48 -0
  2. data/README.md +56 -20
  3. data/Rakefile +9 -34
  4. data/TODO +10 -10
  5. data/VERSION +1 -0
  6. data/bin/gen_stub_rubylib +35 -36
  7. data/bin/rubybreaker +1 -4
  8. data/lib/rubybreaker/debug.rb +8 -4
  9. data/lib/rubybreaker/rubylib/core.rb +738 -571
  10. data/lib/rubybreaker/runtime/inspector.rb +16 -7
  11. data/lib/rubybreaker/runtime/monitor.rb +14 -18
  12. data/lib/rubybreaker/runtime/object_wrapper.rb +9 -3
  13. data/lib/rubybreaker/runtime/overrides.rb +51 -8
  14. data/lib/rubybreaker/runtime/pluggable.rb +1 -3
  15. data/lib/rubybreaker/runtime/type_placeholder.rb +2 -6
  16. data/lib/rubybreaker/runtime/type_system.rb +53 -17
  17. data/lib/rubybreaker/runtime/typesig_parser.rb +1 -0
  18. data/lib/rubybreaker/runtime/util.rb +18 -0
  19. data/lib/rubybreaker/runtime.rb +42 -15
  20. data/lib/rubybreaker/type/type_comparer.rb +10 -10
  21. data/lib/rubybreaker/type/type_grammar.treetop +30 -21
  22. data/lib/rubybreaker/type/type_unparser.rb +2 -2
  23. data/lib/rubybreaker/typing/subtyping.rb +21 -21
  24. data/lib/rubybreaker/util.rb +11 -1
  25. data/lib/rubybreaker.rb +75 -54
  26. data/test/integrated/tc_class_methods.rb +35 -0
  27. data/test/integrated/tc_inherit_broken.rb +29 -0
  28. data/test/integrated/tc_method_missing.rb +1 -1
  29. data/test/runtime/tc_obj_wrapper.rb +104 -4
  30. data/test/ts_integrated.rb +2 -0
  31. data/test/type/tc_comparer.rb +96 -96
  32. data/test/type/tc_parser.rb +18 -0
  33. data/test/type/tc_unparser.rb +16 -0
  34. data/test/typing/tc_typing.rb +20 -20
  35. data/webpage/footer.html +1 -1
  36. data/webpage/header.html +7 -7
  37. data/webpage/index.html +65 -28
  38. data/webpage/rdoc/RubyBreaker/Breakable.html +280 -0
  39. data/webpage/rdoc/RubyBreaker/Broken/BrokenEigen.html +304 -0
  40. data/webpage/rdoc/RubyBreaker/Broken.html +308 -0
  41. data/webpage/rdoc/RubyBreaker/Context.html +421 -0
  42. data/webpage/rdoc/RubyBreaker/Debug.html +411 -0
  43. data/webpage/rdoc/RubyBreaker/Errors/InternalError.html +263 -0
  44. data/webpage/rdoc/RubyBreaker/Errors/InvalidSubtypeCheck.html +263 -0
  45. data/webpage/rdoc/RubyBreaker/Errors/InvalidTypeConstruction.html +214 -0
  46. data/webpage/rdoc/RubyBreaker/Errors/SubtypeFailure.html +212 -0
  47. data/webpage/rdoc/RubyBreaker/Errors/TypeError.html +212 -0
  48. data/webpage/rdoc/RubyBreaker/Errors/UserError.html +264 -0
  49. data/webpage/rdoc/RubyBreaker/Errors.html +209 -0
  50. data/webpage/rdoc/RubyBreaker/Kernel.html +259 -0
  51. data/webpage/rdoc/RubyBreaker/Main.html +560 -0
  52. data/webpage/rdoc/RubyBreaker/ObjectPosition.html +334 -0
  53. data/webpage/rdoc/RubyBreaker/Position.html +463 -0
  54. data/webpage/rdoc/RubyBreaker/RubyTypeUtils.html +308 -0
  55. data/webpage/rdoc/RubyBreaker/Runtime/Inspector.html +380 -0
  56. data/webpage/rdoc/RubyBreaker/Runtime/MethodInfo.html +324 -0
  57. data/webpage/rdoc/RubyBreaker/Runtime/Monitor.html +354 -0
  58. data/webpage/rdoc/RubyBreaker/Runtime/MonitorInstaller.html +379 -0
  59. data/webpage/rdoc/RubyBreaker/Runtime/MonitorSwitch.html +382 -0
  60. data/webpage/rdoc/RubyBreaker/Runtime/MonitorUtils.html +400 -0
  61. data/webpage/rdoc/RubyBreaker/Runtime/ObjectWrapper.html +411 -0
  62. data/webpage/rdoc/RubyBreaker/Runtime/Pluggable.html +305 -0
  63. data/webpage/rdoc/RubyBreaker/Runtime/TypePlaceholder.html +280 -0
  64. data/webpage/rdoc/RubyBreaker/Runtime/TypeSigParser.html +283 -0
  65. data/webpage/rdoc/RubyBreaker/Runtime/TypeSystem.html +630 -0
  66. data/webpage/rdoc/RubyBreaker/Runtime.html +255 -0
  67. data/webpage/rdoc/RubyBreaker/TestCase.html +332 -0
  68. data/webpage/rdoc/RubyBreaker/TypeComparer.html +304 -0
  69. data/webpage/rdoc/RubyBreaker/TypeDefs/AnyType.html +260 -0
  70. data/webpage/rdoc/RubyBreaker/TypeDefs/BlockType.html +310 -0
  71. data/webpage/rdoc/RubyBreaker/TypeDefs/DuckType.html +320 -0
  72. data/webpage/rdoc/RubyBreaker/TypeDefs/FusionType.html +323 -0
  73. data/webpage/rdoc/RubyBreaker/TypeDefs/MethodListType.html +281 -0
  74. data/webpage/rdoc/RubyBreaker/TypeDefs/MethodType.html +282 -0
  75. data/webpage/rdoc/RubyBreaker/TypeDefs/NilType.html +260 -0
  76. data/webpage/rdoc/RubyBreaker/TypeDefs/NominalType.html +282 -0
  77. data/webpage/rdoc/RubyBreaker/TypeDefs/OptionalType.html +281 -0
  78. data/webpage/rdoc/RubyBreaker/TypeDefs/OrType.html +281 -0
  79. data/webpage/rdoc/RubyBreaker/TypeDefs/SelfType.html +329 -0
  80. data/webpage/rdoc/RubyBreaker/TypeDefs/Type.html +409 -0
  81. data/webpage/rdoc/RubyBreaker/TypeDefs/VarLengthType.html +282 -0
  82. data/webpage/rdoc/RubyBreaker/TypeDefs.html +212 -0
  83. data/webpage/rdoc/RubyBreaker/TypeUnparser.html +273 -0
  84. data/webpage/rdoc/RubyBreaker/Typing.html +305 -0
  85. data/webpage/rdoc/RubyBreaker/Utilities.html +294 -0
  86. data/webpage/rdoc/RubyBreaker.html +337 -0
  87. data/webpage/rdoc/created.rid +26 -0
  88. data/webpage/rdoc/images/add.png +0 -0
  89. data/webpage/rdoc/images/brick.png +0 -0
  90. data/webpage/rdoc/images/brick_link.png +0 -0
  91. data/webpage/rdoc/images/bug.png +0 -0
  92. data/webpage/rdoc/images/bullet_black.png +0 -0
  93. data/webpage/rdoc/images/bullet_toggle_minus.png +0 -0
  94. data/webpage/rdoc/images/bullet_toggle_plus.png +0 -0
  95. data/webpage/rdoc/images/date.png +0 -0
  96. data/webpage/rdoc/images/delete.png +0 -0
  97. data/webpage/rdoc/images/find.png +0 -0
  98. data/webpage/rdoc/images/loadingAnimation.gif +0 -0
  99. data/webpage/rdoc/images/macFFBgHack.png +0 -0
  100. data/webpage/rdoc/images/package.png +0 -0
  101. data/webpage/rdoc/images/page_green.png +0 -0
  102. data/webpage/rdoc/images/page_white_text.png +0 -0
  103. data/webpage/rdoc/images/page_white_width.png +0 -0
  104. data/webpage/rdoc/images/plugin.png +0 -0
  105. data/webpage/rdoc/images/ruby.png +0 -0
  106. data/webpage/rdoc/images/tag_blue.png +0 -0
  107. data/webpage/rdoc/images/tag_green.png +0 -0
  108. data/webpage/rdoc/images/transparent.png +0 -0
  109. data/webpage/rdoc/images/wrench.png +0 -0
  110. data/webpage/rdoc/images/wrench_orange.png +0 -0
  111. data/webpage/rdoc/images/zoom.png +0 -0
  112. data/webpage/rdoc/index.html +165 -0
  113. data/webpage/rdoc/js/darkfish.js +153 -0
  114. data/webpage/rdoc/js/jquery.js +18 -0
  115. data/webpage/rdoc/js/navigation.js +142 -0
  116. data/webpage/rdoc/js/search.js +94 -0
  117. data/webpage/rdoc/js/search_index.js +1 -0
  118. data/webpage/rdoc/js/searcher.js +228 -0
  119. data/webpage/rdoc/rdoc.css +543 -0
  120. data/webpage/rdoc/table_of_contents.html +376 -0
  121. data/webpage/rubybreaker.css +31 -31
  122. metadata +93 -6
data/NEWS ADDED
@@ -0,0 +1,48 @@
1
+ # VERSION 0.0.2
2
+
3
+ ## Class Method Support
4
+
5
+ RubyBreaker now supports class methods. Auto-documentation of class methods
6
+ is done in the eigen class scope of the target module. For example, the
7
+ consider the following:
8
+
9
+ class A
10
+ include RubyBreaker::Breakable
11
+ class << self
12
+ def foo(x); x.to_s end
13
+ end
14
+ end
15
+ RubyBreaker.monitor()
16
+ A.foo(1)
17
+
18
+ When `foo` method is run, RubyBreaker will auto-document the type of the
19
+ method and output as the following:
20
+
21
+ class A
22
+ include RubyBreaker::Broken
23
+ class << self
24
+ typesig("foo(fixnum[to_s]) -> string")
25
+ end
26
+ end
27
+
28
+ ## Variable-Length Argument Type
29
+
30
+ RubyBreaker can now auto-document variable-length argument types if the last
31
+ argument was declared with `*` prefix. For instance,
32
+
33
+ class A
34
+ include RubyBreaker::Breakable
35
+ def foo(*args)
36
+ args[0].to_s
37
+ end
38
+ end
39
+ RubyBreaker.monitor()
40
+ A.new.foo("1")
41
+
42
+ Will generate the following output:
43
+
44
+ class A
45
+ include RubyBreaker::Broken
46
+ typesig("foo(string[to_s]*) -> string")
47
+ end
48
+
data/README.md CHANGED
@@ -18,6 +18,11 @@ document their code more rigorously and effectively. Currently, manual
18
18
  modification of the user program is required to run RubyBreaker, but this is
19
19
  kept minimal.
20
20
 
21
+ To contribute to the project, visit RubyBreaker's
22
+ [GitHub page](http://github.com/rockalizer/rubybreaker) and
23
+ [RubyGems page](http://rubygems.org/gems/rubybreaker). RubyBreaker RDoc can
24
+ be found in [here](rdoc/index.html).
25
+
21
26
  ## Limitations
22
27
 
23
28
  * It only works on toy Ruby programs so far :)
@@ -166,11 +171,33 @@ signature `bar(fixnum[to_s]) -> string`, which means it takes an object that
166
171
  has `Fixnum`'s `to_s` method and returns a string. More detail on the type
167
172
  annotation language will be explained in later section.
168
173
 
169
- Currently, both `Breakable` and `Broken` only support instance methods.
170
- Furthermore, class and module methods can neither be monitored nor used for
171
- analysis. It is important to keep in mind that `Broken` module always wins.
172
- In other words, if a module is declared as both `Broken` and `Breakable`, it
173
- is treated as `Broken`.
174
+ It is possible to include either `Breakable` or `Broken` in an eigen-class
175
+ to document class methods. To make this easier, RubyBreaker will
176
+ automatically support auto-documentation and manual documentation of class
177
+ methods if the original module is declared as `Breakable` or `Broken`,
178
+ respectively--that is, up to immediate eigen class level of a "nominal"
179
+ module. The following example shows how class methods can be
180
+ auto-documented and manually documented, respectively.
181
+
182
+ require "rubybreaker"
183
+ class A
184
+ include RubyBreaker::Breakable
185
+ class << self
186
+ def foo(x); x.to_s end
187
+ end
188
+ end
189
+ class B
190
+ include RubyBreaker::Broken
191
+ class << self
192
+ typesig("foo(fixnum[to_s]) -> string")
193
+ def foo(x); x.to_s end
194
+ end
195
+ end
196
+
197
+ Keep in mind that `Broken` module always wins against `Breakable`. In other
198
+ words, if a module is declared as both `Broken` and `Breakable`, it is
199
+ treated as `Broken`. Future versions of RubyBreaker will support a hybrid of
200
+ the two modules, but it remains as a limitation in the current version.
174
201
 
175
202
  ### Program Entry Point
176
203
 
@@ -296,7 +323,7 @@ it should be only used for an object that requires an arbitrary yet most
296
323
  specific type--that is, `?` is a subtype of any other type, but any
297
324
  other type is not a subtype of `?`. This becomes a bit complicated for
298
325
  method or block argument types because of their contra-variance
299
- characteristic. Please kefer to the section *Subtyping*.
326
+ characteristic. Please refer to the section *Subtyping*.
300
327
 
301
328
  ### Block Type
302
329
 
@@ -368,25 +395,34 @@ subsequent "promotions").
368
395
 
369
396
  ## Type System
370
397
 
371
- RubyBreaker comes with its own type system that is used to document type
372
- information. This section describes how RubyBreaker determines which type(s)
373
- to document. *More documentation coming soon...*
374
-
375
- ### Subtyping
376
-
377
- *Documentation coming soon...*
378
-
379
- ### Subtyping vs. Subclassing
380
-
381
- *Documentation coming soon...*
398
+ RubyBreaker comes with its own type system to auto-document the type
399
+ information. Each method in a `Breakable` module is dynamically instrumented
400
+ to be monitored during runtime. This monitoring code observes the types of
401
+ the arguments, block, and return value of each method. Once this information
402
+ is gathered, RubyBreaker will compare it to the information gathered so far.
403
+ If these two types are "compatiable", RubyBreaker will choose more general
404
+ type of the two. Otherwise, RubyBreaker will use the method list type to
405
+ accommodate two "incompatible" types.
406
+
407
+ ### Subtyping and Subclassing
408
+
409
+ RubyBreaker uses subtyping to choose one from the two "compatible" types.
410
+ Two types are "compatible" if one is subtype of another. This means that the
411
+ _subtype_ can be represented using the _supertype_ instead. This is why
412
+ RubyBrekaer chooses the latter to document both types. RubyBreaker relies on
413
+ subclassing of Ruby to determine a subtyping relationship between two types.
414
+ For example, `Fixnum` is considered to be subtype of `Numeric` since the
415
+ former is subclass of the latter. (Strictly speaking, `Fixnum` is not really
416
+ subtype of `Numeric` because some methods are overriden in `Fixnum` with
417
+ method types that are not subtype of the counterparts in `Numeric`. But,
418
+ RubyBreaker is lenient and considers them compatible--that is, `Numeric` can
419
+ represent any `Fixnum`.
382
420
 
383
421
  ### Pluggable Type System (Advanced)
384
422
 
385
423
  Yes, RubyBreaker was designed with the replaceable type system in mind. In
386
424
  other words, anyone can write his own type system and plug it into
387
- RubyBreaker.
388
-
389
- *Documentation coming soon...*
425
+ RubyBreaker. *Technical documentation coming soon...*
390
426
 
391
427
  * * *
392
428
 
data/Rakefile CHANGED
@@ -4,6 +4,7 @@
4
4
  require "rake"
5
5
  require "rake/testtask"
6
6
  require "rdoc/task"
7
+ require "rake/clean"
7
8
 
8
9
  begin
9
10
  require "rdiscount" # used to generate the doc html page
@@ -11,6 +12,13 @@ rescue LoadError => e
11
12
  puts "[WARNING] No rdiscount is installed."
12
13
  end
13
14
 
15
+ # Use rake/clean to remove generated files
16
+ CLEAN.concat(FileList["webpage/rdoc",
17
+ "rubybreaker-*.gem",
18
+ "webpage/index.html",
19
+ "lib/rubybreaker/type/type_grammar.rb"
20
+ ])
21
+
14
22
  # If no task specified, do test
15
23
  task :default => [:test]
16
24
 
@@ -18,28 +26,17 @@ desc "Do all"
18
26
  task :all => [:parser, :test, :rdoc, :webpage, :gem] do |t|
19
27
  end
20
28
 
21
- desc "Clean"
22
- task :clean do |t|
23
- sh 'rm -r -f html'
24
- sh 'rm webpage/index.html'
25
- sh 'rm lib/rubybreaker/type/type_grammar.rb'
26
- end
27
-
28
29
  desc "Generate gemspec"
29
30
  task :gem do |t|
30
31
  sh "gem build rubybreaker.gemspec"
31
32
  end
32
33
 
33
34
  Rake::RDocTask.new do |rd|
35
+ rd.rdoc_dir = "#{File.dirname(__FILE__)}/webpage/rdoc"
34
36
  rd.rdoc_files.include("lib/**/*.rb")
35
37
  rd.rdoc_files.exclude("lib/rubybreaker/rubylib/*.rb", "lib/rubybreaker/type/type_grammar.rb")
36
38
  end
37
39
 
38
- # desc "Generate RDoc"
39
- # task :doc do |t|
40
- # sh "rdoc -x lib/rubybreaker/rubylib -x lib/rubybreaker/type/type_grammar lib"
41
- # end
42
-
43
40
  desc "Generate the webpage"
44
41
  task :webpage do |t|
45
42
  break unless defined?(RDiscount)
@@ -47,28 +44,6 @@ task :webpage do |t|
47
44
  readme_md = "#{dir}/README.md"
48
45
  output = "#{dir}/webpage/index.html"
49
46
  body = RDiscount.new(File.read(readme_md)).to_html
50
- # header = <<-EOS
51
- # <html>
52
- # <head>
53
- # <title>RubyBreaker</title>
54
- # <LINK REL=StyleSheet HREF="rubybreaker.css" TYPE="text/css">
55
- # <script type="text/javascript" src="generated_toc.js"> </script>
56
- # </head>
57
- # <body onLoad="createTOC()">
58
- # <center>
59
- # <div id="content">
60
- # <div id="logo">
61
- # <img src="images/logo.png" border="0">
62
- # </div>
63
- # <hr />
64
- # <div id="generated-toc"></div>
65
- # EOS
66
- # footer = <<-EOS
67
- # </div>
68
- # </center>
69
- # </body>
70
- # </html>
71
- # EOS
72
47
  header = File.read("#{dir}/webpage/header.html")
73
48
  footer = File.read("#{dir}/webpage/footer.html")
74
49
  html = header + body + footer
data/TODO CHANGED
@@ -1,13 +1,3 @@
1
- # Variable-length Argument Type
2
-
3
- Currently, the variable-length argument type cannot be auto-documented.
4
- This can be done by looking at the method arity and initializes the method
5
- type to have a variable-length argument type for the last argument.
6
-
7
- # Module Methods and Class Methods
8
-
9
- RubyBreaker only monitors instance methods at the moment.
10
-
11
1
  # Dynamic Type Check
12
2
 
13
3
  Although type documentation is the main purpose of RubyBreaker, this
@@ -21,6 +11,16 @@ A module or class cannot be both Breakable and Broken. Once it is declared
21
11
  to be Broken, it is Broken no matter what. In theory, it is possible to
22
12
  selectively auto-document methods that are not yet documented.
23
13
 
14
+ # RDoc Documentation
15
+
16
+ The output of RubyBreaker is an executable Ruby code (for the convenience of
17
+ the author). But, for most Ruby programmers, this documentation may be more
18
+ useful if the output was somehow incorporated with the RDoc output.
19
+
20
+ # Ruby on Rails Support
21
+
22
+ Duh...
23
+
24
24
  # PERMANENT LIMITATIONS
25
25
 
26
26
  * Block argument cannot be auto-documented.
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.2
data/bin/gen_stub_rubylib CHANGED
@@ -3,55 +3,54 @@
3
3
 
4
4
  require "prettyprint"
5
5
 
6
- BLACKLIST = [:Config, :Class, :Module]
6
+ BLACKLIST = [:Config, :Class, :Module, :BasicObject]
7
7
 
8
8
  def get_const(const_name, binding, visited)
9
- return false if BLACKLIST.include?(:"#{const_name}")
10
- validated = true
11
- begin
12
- const = eval(const_name.to_s, binding)
13
- rescue
14
- validated = false
15
- end
16
- return nil unless const.kind_of?(Module) && !visited.include?(const)
17
- return const
9
+ return false if BLACKLIST.include?(:"#{const_name}")
10
+ validated = true
11
+ begin
12
+ const = eval(const_name.to_s, binding)
13
+ rescue
14
+ validated = false
15
+ end
16
+ return nil unless const.kind_of?(Module) && !visited.include?(const)
17
+ return const
18
18
  end
19
19
 
20
20
  def visit(pp, mod, binding, visited=[])
21
- visited << mod
22
- keyword = mod.kind_of?(Class) ? "class" : "module"
23
- new_binding = eval("#{keyword} #{mod.name}; binding() end", binding)
21
+ visited << mod
22
+ keyword = mod.kind_of?(Class) ? "class" : "module"
23
+ new_binding = eval("#{keyword} #{mod.name}; binding() end", binding)
24
24
  pp.breakable()
25
- pp.text("#{keyword} #{mod.name}")
26
- pp.group(2) do
25
+ pp.text("#{keyword} #{mod.name} #:nodoc:", 80)
26
+ pp.group(2) do
27
27
  pp.breakable(";")
28
- pp.text("include RubyBreaker::Broken")
29
- inst_meths = mod.instance_methods(false).sort
30
- inst_meths.each {|meth|
28
+ pp.text("include RubyBreaker::Broken", 80)
29
+ inst_meths = mod.instance_methods(false).sort
30
+ inst_meths.each {|meth|
31
31
  pp.breakable(";")
32
- pp.text("typesig(\"#{meth}(?*) -> basic_object\")")
33
- }
34
- consts = mod.constants.sort
35
- consts.each do |const_name|
36
- const = get_const(const_name, new_binding, visited)
37
- next unless const
32
+ pp.text("typesig(\"#{meth}(?*) -> basic_object\")")
33
+ }
34
+ consts = mod.constants.sort
35
+ consts.each do |const_name|
36
+ const = get_const(const_name, new_binding, visited)
37
+ next unless const
38
38
  pp.breakable()
39
- visit(pp, const, new_binding, visited)
40
- end
41
- end
42
- pp.breakable()
43
- pp.text("end # of #{mod.name}")
44
- pp.breakable(";")
39
+ visit(pp, const, new_binding, visited)
40
+ end
41
+ end
42
+ pp.breakable()
43
+ pp.text("end # of #{mod.name}", 80)
45
44
  end
46
45
 
47
46
  def visit_toplevel(pp,visited=[])
48
- visited << Object
49
- Object.constants.sort.each do |const_name|
50
- const = get_const(const_name, TOPLEVEL_BINDING, visited)
51
- next unless const
47
+ visited << Object
48
+ Object.constants.sort.each do |const_name|
49
+ const = get_const(const_name, TOPLEVEL_BINDING, visited)
50
+ next unless const
52
51
  pp.breakable()
53
- visit(pp, const, TOPLEVEL_BINDING, visited)
54
- end
52
+ visit(pp, const, TOPLEVEL_BINDING, visited)
53
+ end
55
54
  end
56
55
 
57
56
  str = ""
data/bin/rubybreaker CHANGED
@@ -1,8 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  require "optparse"
3
3
 
4
- dir = File.dirname(__FILE__)
5
- require "#{dir}/../lib/rubybreaker"
4
+ require_relative "../lib/rubybreaker"
6
5
 
7
6
  module RubyBreaker
8
7
 
@@ -63,5 +62,3 @@ end
63
62
 
64
63
  RubyBreaker.main()
65
64
 
66
-
67
-
@@ -12,8 +12,12 @@ module RubyBreaker
12
12
 
13
13
  OUTPUT = ""
14
14
 
15
+ def self.debug_mode?()
16
+ return defined?(RubyBreaker::OPTIONS) && RubyBreaker::OPTIONS[:debug]
17
+ end
18
+
15
19
  def self.msg(text,context=nil)
16
- return unless RubyBreaker::OPTIONS[:debug]
20
+ return unless self.debug_mode?
17
21
  pp = PrettyPrint.new(OUTPUT)
18
22
  msg = "[DEBUG] #{text}"
19
23
  if context
@@ -28,18 +32,18 @@ module RubyBreaker
28
32
  end
29
33
 
30
34
  def self.short_msg(text)
31
- return unless RubyBreaker::OPTIONS[:debug]
35
+ return unless self.debug_mode?
32
36
  msg = "[DEBUG] #{text}"
33
37
  print msg
34
38
  end
35
39
 
36
40
  def self.token(msg)
37
- return unless RubyBreaker::OPTIONS[:debug]
41
+ return unless self.debug_mode?
38
42
  print msg
39
43
  end
40
44
 
41
45
  def self.feed_line()
42
- return unless RubyBreaker::OPTIONS[:debug]
46
+ return unless self.debug_mode?
43
47
  puts ""
44
48
  end
45
49