Parent

Methods

RText::Serializer

Public Class Methods

new(language) click to toggle source

Creates a serializer for RText::Language language.

# File lib/rtext/serializer.rb, line 10
def initialize(language)
  @lang = language
end

Public Instance Methods

serialize(elements, writer, options={}) click to toggle source

Serialize elements to writer. Options:

:set_line_number
  if set to true, the serializer will try to update the line number attribute of model
  elements, while they are serialized, given that they have the line_number_attribute
  specified in the RText::Language
  default: don't set line number

:fragment_ref
  an object referencing a fragment, this will be set on all model elements while they
  are serialized, given that they have the fragment_ref_attribute specified in the
  RText::Language
  default: don't set fragment reference
# File lib/rtext/serializer.rb, line 28
def serialize(elements, writer, options={})
  @writer = writer
  @set_line_number = options[:set_line_number]
  @fragment_ref = options[:fragment_ref]
  @line_number = 1
  @indent = 0
  if elements.is_a?(Array)
    serialize_elements(elements)
  else
    serialize_elements([elements])
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.