Class: ConsoleFormatter
- Inherits:
-
Object
- Object
- ConsoleFormatter
- Defined in:
- lib/dbexpect/console_formatter.rb
Overview
Copyright 2012 C3 Business Solutions
This file is part of dbexpect.
dbexpect is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
dbexpect is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with dbexpect. If not, see <http://www.gnu.org/licenses/>.
Instance Method Summary collapse
- #format_sql(sql) ⇒ Object
-
#initialize(output) ⇒ ConsoleFormatter
constructor
A new instance of ConsoleFormatter.
- #notify_failed(failed_expectations) ⇒ Object
- #notify_passed ⇒ Object
Constructor Details
#initialize(output) ⇒ ConsoleFormatter
Returns a new instance of ConsoleFormatter.
18 19 20 |
# File 'lib/dbexpect/console_formatter.rb', line 18 def initialize(output) @output = output end |
Instance Method Details
#format_sql(sql) ⇒ Object
37 38 39 |
# File 'lib/dbexpect/console_formatter.rb', line 37 def format_sql(sql) @output.puts sql end |
#notify_failed(failed_expectations) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/dbexpect/console_formatter.rb', line 26 def notify_failed(failed_expectations) failed_expectations.traverse do |depth, description, expectations| @output.puts((' ' * depth) + description + ":\n") expectations.collect(&:failure_message).each do |msg| @output.puts((' ' * depth) + ' ' + msg + "\n") end end @output.puts "Failed to meet expectations\n" end |
#notify_passed ⇒ Object
22 23 24 |
# File 'lib/dbexpect/console_formatter.rb', line 22 def notify_passed @output.puts "Passed all expectations\n" end |