module ActiveFile::HashAndArrayFiles
Public Instance Methods
raw_data()
click to toggle source
# File lib/active_file/hash_and_array_files.rb, line 3 def raw_data if multiple_files? data_from_multiple_files else load_path(full_path) end end
Private Instance Methods
data_from_multiple_files()
click to toggle source
# File lib/active_file/hash_and_array_files.rb, line 12 def data_from_multiple_files loaded_files = full_paths.collect { |path| load_path(path) } if loaded_files.all?{ |file_data| file_data.is_a?(Array) } loaded_files.sum elsif loaded_files.all?{ |file_data| file_data.is_a?(Hash) } loaded_files.inject({}) { |hash, file_data| hash.merge(file_data) } else raise ActiveHash::FileTypeMismatchError.new("Choose between hash or array syntax") end end