0.0
No commit activity in last 3 years
No release in over 3 years
You can check if DateTime is past.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 5.0.0
 Project Readme

PastChecker

You can check if DateTime is past.

Usage

when you create a Date or DateTime column in the ActiveModel on Rails with the following form, a method is defined that can check if it is past.

ll_be_foo -> #foo?
will_be_bar -> #bar?
ll_be_baz_at -> #baz?
will_be_qux_at -> #qux?

Please select from among these depending on the context you use.

Example

MigrationFile

class CreateHoges < ActiveRecord::Migration[5.0]
  def change
    create_table :Foobars do |t|
      t.datetime :ll_be_started_at
      t.date :will_be_executed

      t.timestamps
    end
  end
end

Rails Console

rails c

irb(main):001:0> Foobar.new(ll_be_started_at: Time.now + 1.minute).started?
=> false

irb(main):002:0> Foobar.new(ll_be_started_at: Time.now - 1.minute).started?
=> true

irb(main):003:0> Foobar.new(will_be_executed: Date.today + 1.day).executed?
=> true

irb(main):004:0> Foobar.new(will_be_executed: Date.today - 1.day).executed?
=> false

irb(main):005:0> Foobar.new(will_be_executed: Date.today).executed?
=> true

Installation

Add this line to your application's Gemfile:

gem 'past-checker'

And then execute:

$ bundle install

Contributing

Contribution directions go here.

License

The gem is available as open source under the terms of the MIT License.