aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorkazuyoshi tlacaelel <kazu.dev@gmail.com>2012-04-03 14:02:06 -0500
committerkazuyoshi tlacaelel <kazu.dev@gmail.com>2012-04-03 14:02:06 -0500
commit76facee915f478488b8ae53651b165d9a9f72765 (patch)
treee5d70f8edfeed2a4a1661ed740d3b60aa39e51c5 /lib
parentddb7fc2fc1d9b1a55518263ebb847c9fd428ec1c (diff)
Buffering is not consoles responsibility.
Diffstat (limited to 'lib')
-rw-r--r--lib/cobalt.rb24
1 files changed, 2 insertions, 22 deletions
diff --git a/lib/cobalt.rb b/lib/cobalt.rb
index a85409f..ce42a5d 100644
--- a/lib/cobalt.rb
+++ b/lib/cobalt.rb
@@ -6,13 +6,11 @@ module Cobalt
class Console
- attr_accessor :keep_in_buffer, :separator_length
+ attr_accessor :separator_length
def initialize( options = {} )
@indent = 0
@loggers = options[:loggers] || [::Logger.new(STDOUT)]
- @keep_in_buffer = false
- @temporal_buffer = []
@separator_length = 120
@color = :white
end
@@ -25,30 +23,12 @@ module Cobalt
@loggers = @loggers - [logger]
end
- def release_buffer
- @keep_in_buffer = false
- @temporal_buffer.each do |line|
- @loggers.each { |logger| logger.info(line) }
- end
- @temporal_buffer = []
- nil
- end
-
def log(*objects)
objects.each do |object|
-
the_string = object.to_s
the_string = the_string.to_ansi.send(@color).to_s
the_string = the_string.gsub(/^/, ' ' * @indent)
-
- @loggers.each do |logger|
- if @keep_in_buffer
- @temporal_buffer << the_string
- next
- end
- logger.info the_string
- end
-
+ @loggers.each { |logger| logger.info(the_string) }
end
self
end