Module: Toast::ConfigDSL

Defined in:
lib/toast/config_dsl.rb

Defined Under Namespace

Classes: Base, InCollection

Class Method Summary collapse

Class Method Details

.sanitize(list, name) ⇒ Object

checks if list is made of symbols and strings converts a single value to an Array converts all symbols to strings



157
158
159
160
161
162
163
164
165
166
167
# File 'lib/toast/config_dsl.rb', line 157

def self.sanitize list, name
  list = [list].flatten

  list.map do |x|
    if (!x.is_a?(Symbol) && !x.is_a?(String))
      raise "Toast Config Error: '#{name}' should be a list of Symbols or Strings"
    else
      x.to_s
    end
  end
end