Class: Ever2boost::CsonGenerator
- Inherits:
-
Object
- Object
- Ever2boost::CsonGenerator
- Defined in:
- lib/ever2boost/cson_generator.rb
Class Method Summary collapse
- .build(folder_hash, note) ⇒ Object
- .output(folder_hash, note, output_dir) ⇒ Object
- .timestamp ⇒ Object
Class Method Details
.build(folder_hash, note) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/ever2boost/cson_generator.rb', line 6 def build(folder_hash, note) cson = "type: \"MARKDOWN_NOTE\"\nfolder: \"\#{folder_hash}\"\ntitle: \"\#{note.title}\"\ncontent: '''\n # \#{note.title}\n \#{note.md_content}\n'''\ntags: []\nisStarred: false\ncreatedAt: \"\#{timestamp}\"\nupdatedAt: \"\#{timestamp}\"\n EOS\nend\n" |
.output(folder_hash, note, output_dir) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/ever2boost/cson_generator.rb', line 26 def output(folder_hash, note, output_dir) Util.make_notes_dir(output_dir) File.open("#{output_dir}/notes/#{note.file_name}.cson", 'w') do |f| f.write(build(folder_hash, note)) end end |
.timestamp ⇒ Object
22 23 24 |
# File 'lib/ever2boost/cson_generator.rb', line 22 def Time.new.getutc.strftime('%Y-%m-%dT%H:%M:%S') end |