Method: Condition::Reader::ConvertSheet#convert_file

Defined in:
lib/condition/reader/convert_sheet.rb

#convert_file(path, prefix: nil) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/condition/reader/convert_sheet.rb', line 17

def convert_file(path, prefix: nil)
  name = File.basename(path, ".*")
  ss =  Roo::Spreadsheet.open(path)
  ss.sheets.each do |it|
    ss.default_sheet = it
    blocks = @reader.read(ss)
    key = "#{name}_#{it}"
    key = "#{prefix}_#{key}" if !prefix.nil?
    @redis.set(key, JSON.generate(blocks))
  end
end