Class: Ripper::EventLog
- Defined in:
- lib/ripper/event_log.rb
Instance Attribute Summary collapse
-
#log ⇒ Object
readonly
Returns the value of attribute log.
Class Method Summary collapse
Instance Method Summary collapse
- #highlight(str) ⇒ Object
-
#initialize(src) ⇒ EventLog
constructor
A new instance of EventLog.
- #out ⇒ Object
Constructor Details
#initialize(src) ⇒ EventLog
Returns a new instance of EventLog.
16 17 18 19 |
# File 'lib/ripper/event_log.rb', line 16 def initialize(src) @log = [] super end |
Instance Attribute Details
#log ⇒ Object (readonly)
Returns the value of attribute log.
14 15 16 |
# File 'lib/ripper/event_log.rb', line 14 def log @log end |
Class Method Details
.out(src) ⇒ Object
7 8 9 10 11 |
# File 'lib/ripper/event_log.rb', line 7 def out(src) parser = new(src) parser.parse parser.out end |
Instance Method Details
#highlight(str) ⇒ Object
33 34 35 |
# File 'lib/ripper/event_log.rb', line 33 def highlight(str) Highlighters::Ansi.new(:bold, :green).highlight(str) end |
#out ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ripper/event_log.rb', line 21 def out log.each do |type, sexp| arg = sexp[1] =~ /\s/ ? sexp[1].inspect : sexp[1] line = (sexp[0].to_s).ljust(20) if type == :scanner puts line + arg[0..30] else puts highlight(line) end end end |