Class: Logue::BlockElement

Inherits:
BaseElement show all
Defined in:
lib/logue/elements/block_element.rb

Instance Attribute Summary

Attributes inherited from BaseElement

#context, #writer

Instance Method Summary collapse

Methods inherited from BaseElement

#write_line, #write_msg_object

Constructor Details

#initialize(msg, context, writer, &blk) ⇒ BlockElement



5
6
7
8
9
# File 'lib/logue/elements/block_element.rb', line 5

def initialize msg, context, writer, &blk
  super context, writer
  @msg = msg
  @blk = blk
end

Instance Method Details

#write_elementObject



11
12
13
14
# File 'lib/logue/elements/block_element.rb', line 11

def write_element
  obj = @blk.call
  write_msg_object @msg, obj
end