Sha256: 744a3da15a171bbb8be465f05e6403b7a558c441b9a53964f525d2cac4ec847d

Contents?: true

Size: 606 Bytes

Versions: 3

Compression:

Stored size: 606 Bytes

Contents

# frozen_string_literal: true

require "time"

module SmartTodo
  module Events
    # An event that check if the passed date is passed
    class Date
      # @param on_date [String] a string parsable by Time.parse
      # @return [String, false]
      def self.met?(on_date)
        if Time.now >= Time.parse(on_date)
          message(on_date)
        else
          false
        end
      end

      # @param on_date [String]
      # @return [String]
      def self.message(on_date)
        "We are past the *#{on_date}* due date and your TODO is now ready to be addressed."
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
smart_todo-1.4.3 lib/smart_todo/events/date.rb
smart_todo-1.3.1 lib/smart_todo/events/date.rb
smart_todo-1.3.0 lib/smart_todo/events/date.rb