Sha256: 8774199d8eb1b021fd002e958668817da427dec9b6afeef7c3bf42981cb37014

Contents?: true

Size: 707 Bytes

Versions: 2

Compression:

Stored size: 707 Bytes

Contents

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

      #
      # @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
        ["month-#{Date.today.month}"]
      end

      #
      # @since 0.3.7
      def should_create?
        today_is_first_of_month = Date.today.day == 1

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

        found.entity.nil? && today_is_first_of_month
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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