DEV Community

loading...
Cover image for The taco_tuesday gem, cause Tacos

The taco_tuesday gem, cause Tacos

drbragg profile image Drew Bragg ・1 min read

For years I've had to add:

class Date
  def taco_tuesday?
    tuesday?
  end
end
Enter fullscreen mode Exit fullscreen mode

to my ruby projects so I could easily check if it was Taco Tuesday.

But No More!

Introducing the taco_tuesday gem!

Simply add this line to your application's Gemfile:

gem 'taco_tuesday'
Enter fullscreen mode Exit fullscreen mode

And then execute:

$ bundle install
Enter fullscreen mode Exit fullscreen mode

Now you can easily check if it's taco tuesday.

With the Date class:

require 'taco_tuesday'

# May 26th 2020 is a Tuesday
tuesday = Date.new(2020, 5, 26)
tuesday.taco_tuesday? #=> true

# May 25th 2020 is a Monday
monday = Date.new(2020, 5, 25)
monday.taco_tuesday? #=> false

# Check if today is Taco Tuesday
Date.today.taco_tuesday? #=> Same result as Date.today.tuesday?
Enter fullscreen mode Exit fullscreen mode

With the Time class:

require 'taco_tuesday'

# May 26th 2020 is a Tuesday
tuesday = Time.new(2020, 5, 26)
tuesday.taco_tuesday? #=> true

# May 25th 2020 is a Monday
monday = Time.new(2020, 5, 25)
monday.taco_tuesday? #=> false

# Check if today is Taco Tuesday
Time.now.taco_tuesday? #=> Same result as Time.now.tuesday?
Enter fullscreen mode Exit fullscreen mode

Yes, this is a real gem and yes, you can contribute (though I'm not sure what we could add... ideas?).

I hope this post and gem gives you as good of a chuckle as it did for me.

Discussion (3)

pic
Editor guide
Collapse
andreasjakof profile image
Andreas Jakof

Well...
Muffin Monday?
Schnitzel Wednesday?
Chicken Thursday?
Fishy Friday?

Collapse
drbragg profile image
Drew Bragg Author

Schnitzel Wednesday

😂 😂 😂

Collapse
andreasjakof profile image
Andreas Jakof

Sometimes its Burger Wednesday instead of Schnitzel or Crispy Duck with Peanutbutter Sauce.
And it is never fishy Friday, but it sounded nice.