Method: Jekyll::DataReader#read_data_file
- Defined in:
- lib/ngage/jekyll/readers/data_reader.rb
#read_data_file(path) ⇒ Object
Determines how to read a data file.
Returns the contents of the data file.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/ngage/jekyll/readers/data_reader.rb', line 54 def read_data_file(path) case File.extname(path).downcase when ".csv" CSV.read(path, :headers => true, :encoding => site.config["encoding"]).map(&:to_hash) when ".tsv" CSV.read(path, :col_sep => "\t", :headers => true, :encoding => site.config["encoding"]).map(&:to_hash) else SafeYAML.load_file(path) end end |