Sha256: f7e42399806ea4b4d5bb0123c634684000f9e36d185c0e5c97540b02c98ab98b

Contents?: true

Size: 654 Bytes

Versions: 2

Compression:

Stored size: 654 Bytes

Contents

# frozen_string_literal: true

require "time"

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
smart_todo-1.6.0 lib/smart_todo/events/date.rb
smart_todo-1.5.0 lib/smart_todo/events/date.rb