Sha256: 0e04a64157c666a156b28abccbc1389f9e566b456db31aebc10ff28180fb3cc1

Contents?: true

Size: 673 Bytes

Versions: 2

Compression:

Stored size: 673 Bytes

Contents

module Evertils
  module Type
    class Weekly < Type::Base
      NOTEBOOK = :Weekly

      #
      # @since 0.3.7
      def initialize(config, *args)
        super(config, *args)

        @title = @format.date_templates[NOTEBOOK]
        @content = @format.template_contents(NOTEBOOK)
      end

      #
      # @since 0.3.9
      def tags
        ["week-#{Date.today.cweek}"]
      end

      #
      # @since 0.3.7
      def should_create?
        is_monday = Date.today.monday?

        weekly_note_title = @format.date_templates[NOTEBOOK]
        found = @model.find_note_contents(weekly_note_title)

        found.entity.nil? && is_monday
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
evertils-0.3.10 lib/evertils/types/weekly.rb
evertils-0.3.9 lib/evertils/types/weekly.rb