Class: MasterView::TemplateProcessing::MIOSerializer

Inherits:
Object
  • Object
show all
Defined in:
lib/masterview/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ MIOSerializer

Returns a new instance of MIOSerializer.

Raises:

  • (RequiredArgumentMissingError)


231
232
233
234
235
# File 'lib/masterview/parser.rb', line 231

def initialize(options)
  raise RequiredArgumentMissingError.new("Required argument is missing, specify the MasterViewIO object in options[:output_mio_tree]") unless options[:output_mio_tree]
  @options = options
  @mio_tree = options[:output_mio_tree]
end

Instance Method Details

#serialize(render_mode, tag) ⇒ Object



237
238
239
240
241
# File 'lib/masterview/parser.rb', line 237

def serialize(render_mode, tag)
  data_to_write = tag.data.join
  data_to_write = tag.prolog + "\n" + data_to_write unless tag.prolog.nil? #prepend prolog if exists
  @mio_tree.path(render_mode.output).write(data_to_write, @options)
end