class Lingo::Attendee::AnalysisFilter

Constants

FIELDS

Public Instance Methods

control(cmd, *) click to toggle source
# File lib/lingo/attendee/analysis_filter.rb, line 48
def control(cmd, *)
  :skip_command if cmd == :EOL
end
init() click to toggle source
# File lib/lingo/attendee/analysis_filter.rb, line 44
def init
  @csv, @header = CSV.new('', row_sep: ''), FIELDS.keys
end
process(obj, *) click to toggle source
# File lib/lingo/attendee/analysis_filter.rb, line 52
def process(obj, *)
  forward_row(@header.tap { @header = nil }) if @header

  obj.is_a?(Token) ?
    forward_obj(obj, obj, obj, obj) : begin
  tok = obj.token
    forward_obj(obj, nil, tok, tok, obj, obj)
  obj.lexicals.each { |lex|
    forward_obj(lex, nil, tok, tok, lex, obj) }
  end
end

Private Instance Methods

forward_obj(*args) click to toggle source
# File lib/lingo/attendee/analysis_filter.rb, line 66
def forward_obj(*args)
  forward_row(FIELDS.map.with_index { |(_, method), index|
    arg = args[index] and arg.send(method) })
end
forward_row(row) click to toggle source
# File lib/lingo/attendee/analysis_filter.rb, line 71
def forward_row(row)
  forward(@csv.add_row(row).string.dup)
  @csv.string.clear
  @csv.rewind
end