Class: CoffeeTrace::InsertLogging
- Inherits:
-
Object
- Object
- CoffeeTrace::InsertLogging
- Defined in:
- lib/coffee_trace/insert_logging.rb
Instance Method Summary collapse
-
#initialize(insert_log_statement = CoffeeTrace::InsertLogStatement.new) ⇒ InsertLogging
constructor
A new instance of InsertLogging.
- #into(lines, prefix = nil) ⇒ Object
- #is_coffee_trace_log?(line) ⇒ Boolean
Constructor Details
#initialize(insert_log_statement = CoffeeTrace::InsertLogStatement.new) ⇒ InsertLogging
Returns a new instance of InsertLogging.
4 5 6 |
# File 'lib/coffee_trace/insert_logging.rb', line 4 def initialize insert_log_statement=CoffeeTrace::InsertLogStatement.new @insert_log_statement = insert_log_statement end |
Instance Method Details
#into(lines, prefix = nil) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/coffee_trace/insert_logging.rb', line 8 def into lines, prefix=nil result = [] lines.each do |line| result.pop if is_coffee_trace_log?(line) result << line result << (@insert_log_statement.for line, prefix) end result.compact end |
#is_coffee_trace_log?(line) ⇒ Boolean
18 19 20 |
# File 'lib/coffee_trace/insert_logging.rb', line 18 def is_coffee_trace_log? line return true if /#coffee_trace$/.match line end |