class Lingo::Database::Source::MultiValue

Constants

DEFAULT_SEPARATOR

Public Class Methods

new(*) click to toggle source
Calls superclass method
# File lib/lingo/database/source/multi_value.rb, line 43
def initialize(*)
  super
  @pat = /^#{@wrd}(?:#{Regexp.escape(@sep)}#{@wrd})*$/
end

Public Instance Methods

dump_line(key, val, sep = @sep, *) click to toggle source
# File lib/lingo/database/source/multi_value.rb, line 57
def dump_line(key, val, sep = @sep, *)
  val.map(&:form).join(sep)
end
parse_line(line, key, val) click to toggle source
# File lib/lingo/database/source/multi_value.rb, line 53
def parse_line(line, key, val)
  [nil, line.split(@sep).each(&:strip!)]
end
set(db, key, val) click to toggle source
# File lib/lingo/database/source/multi_value.rb, line 48
def set(db, key, val)
  values = val.map { |v| @def ? lexical(v, @def) : v }
  val.each { |v| db[v] = values }
end