class Lingo::Database::Source::MultiKey
Constants
- DEFAULT_SEPARATOR
Public Class Methods
new(*)
click to toggle source
Calls superclass method
# File lib/lingo/database/source/multi_key.rb, line 44 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_key.rb, line 59 def dump_line(key, val, sep = @sep, *) val.map(&:form).unshift(key).join(sep) end
parse_line(line, key, val)
click to toggle source
# File lib/lingo/database/source/multi_key.rb, line 54 def parse_line(line, key, val) values = line.split(@sep).each(&:strip!) [values.shift, values] end
set(db, key, val)
click to toggle source
# File lib/lingo/database/source/multi_key.rb, line 49 def set(db, key, val) key = lexical(key, @def) if @def val.each { |v| db[v] = [key] } end