Sha256: d8a1919bf814aca25398d6bc57934de2f2f6d4824ecf8b14b776975fe3c7adb9

Contents?: true

Size: 677 Bytes

Versions: 1

Compression:

Stored size: 677 Bytes

Contents

require 'evertils/common/query/simple'

module Evertils
  module Controller
    class Render < Controller::Base
      def from_file(config)
        @config = config
        return Notify.warning("Note already exists\n- #{@link}") if note_exists?

        Notify.info 'Note not found, creating a new one'

        query = Evertils::Common::Query::Simple.new
        query.create_note_from_yml(@config[:path])
      end

      def note_exists?
        helper = Evertils::Helper.load('Note')
        note = helper.wait_for(@config[:notebook].to_sym, 3)
        @link = helper.external_url_for(note.entity) unless note.entity.nil?

        note.exists?
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
evertils-1.0.0 lib/evertils/controllers/render.rb