module ForceArray

Public Instance Methods

force_array() click to toggle source

So we can accept a list string (“item1.yml,item2.yml”) or a single item (“item1.yml”) and convert to array as needed

# File lib/liquidoc.rb, line 1194
def force_array
  obj = self
  unless obj.class == Array
    if obj.class == String
      if obj.include? ","
        obj = obj.split(",") # Will even force a string with no commas to a 1-item array
      else
        obj = Array.new.push(obj)
      end
    else
      raise "ForceArrayFail"
    end
  end
  return obj.to_ary
end