Sha256: 20f6afdb9e3e3998450f5eae2e7bdfc2729c8fe39a3d53837716b66861b8c325

Contents?: true

Size: 606 Bytes

Versions: 5

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

5 entries across 5 versions & 1 rubygems

Version Path
smart_todo-1.2.0 lib/smart_todo/events/date.rb
smart_todo-1.1.0 lib/smart_todo/events/date.rb
smart_todo-1.0.2 lib/smart_todo/events/date.rb
smart_todo-1.0.1 lib/smart_todo/events/date.rb
smart_todo-1.0.0 lib/smart_todo/events/date.rb