Class: Logue::ElementsWriter

Inherits:
BaseWriter show all
Defined in:
lib/logue/elements/elements_writer.rb

Instance Attribute Summary

Attributes inherited from BaseWriter

#colorize_line, #colors, #output

Instance Method Summary collapse

Methods inherited from BaseWriter

#initialize, #print, #write

Constructor Details

This class inherits a constructor from Logue::BaseWriter

Instance Method Details

#write_block(location, level, &blk) ⇒ Object



23
24
25
26
27
# File 'lib/logue/elements/elements_writer.rb', line 23

def write_block location, level, &blk
  lines = ElementLines.new @output, location
  element = BlockElement.new ObjectUtil::NONE, Array.new, lines, &blk
  write_element element
end

#write_element(element) ⇒ Object



29
30
31
# File 'lib/logue/elements/elements_writer.rb', line 29

def write_element element
  element.write_element
end

#write_msg_blk(location, msg, level, &blk) ⇒ Object



16
17
18
19
20
21
# File 'lib/logue/elements/elements_writer.rb', line 16

def write_msg_blk location, msg, level, &blk
  # we're not using the level, which at this point only is for colorizing output
  lines = ElementLines.new @output, location
  element = BlockElement.new msg, Array.new, lines, &blk
  write_element element
end

#write_msg_obj(location, msg, obj, level) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/logue/elements/elements_writer.rb', line 8

def write_msg_obj location, msg, obj, level
  # we're not using the level, which at this point only is for colorizing output
  lines = ElementLines.new @output, location
  factory = ElementFactory.new lines
  element = factory.to_element msg, obj, Array.new
  write_element element
end