Class: SymbolArray

Inherits:
Array
  • Object
show all
Defined in:
lib/symbol_array.rb

Class Method Summary collapse

Class Method Details

.dump(array) ⇒ Object

Convert SymbolArray to DB format (string)


9
10
11
# File 'lib/symbol_array.rb', line 9

def dump(array)
  [array].flatten.map(&:to_s).sort.join(', ')
end

.load(string) ⇒ Object

Convert DB format (string) to SymbolArray


4
5
6
# File 'lib/symbol_array.rb', line 4

def load(string)
  string.to_s.strip.split(/[[:space:]]*\,[[:space:]]*/).map(&:to_sym)
end