Class: Ever2boost::JsonGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/ever2boost/json_generator.rb

Class Method Summary collapse

Class Method Details

.build(notebook_list) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ever2boost/json_generator.rb', line 7

def build(notebook_list)
  {
    folders: notebook_list.map do |list|
      {
        key: list.hash,
        name: list.title,
        color: list.color
      }
    end,
    version: '1.0'
  }.to_json
end

.output(notebook_list, output_dir) ⇒ Object



20
21
22
23
24
25
# File 'lib/ever2boost/json_generator.rb', line 20

def output(notebook_list, output_dir)
  Util.make_notes_dir(output_dir)
  File.open("#{output_dir}/boostnote.json", 'w') do |f|
    f.write(build(notebook_list))
  end
end