class Lingo::Attendee::Formatter

Public Instance Methods

init() click to toggle source
Calls superclass method
# File lib/lingo/attendee/formatter.rb, line 32
def init
  super

  @ext    = get_key('ext', '-')
  @format = get_key('format', '%s')
  @map    = get_key('map', Hash.identity)

  @no_puts = true
end
process(obj) click to toggle source
# File lib/lingo/attendee/formatter.rb, line 42
def process(obj)
  if obj.is_a?(WordForm)
    str = obj.form

    if obj.is_a?(Word)
      # TODO: which lexical to select? (currently: first)

      obj.each_lex { |lex|
        att = @map[lex.attr] and str = @format % [str, lex.form, att] }
    end
  else
    str = obj.to_s
  end

  @lir ? @lir_rec_buf << str : @file.print(str)
end