Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

concrete_holidays

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

concrete_holidays

  • 1.0.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

ConcreteHolidays

Gem Version Build Status

The ConcreteHolidays gem was built to calculate if a given date is a holiday using plain old ruby objects.

Example Usage

class MyHolidays < ConcreteHolidays
  def default_holidays
    add_holiday ConcreteHolidays::NewYearsDayObserved
    add_holiday ConcreteHolidays::MemorialDay
    add_holiday ConcreteHolidays::IndependenceDayObserved
    add_holiday ConcreteHolidays::LaborDay
    add_holiday ConcreteHolidays::Thanksgiving
    add_holiday ConcreteHolidays::BlackFriday
    add_holiday ConcreteHolidays::ChristmasEve
    add_holiday ConcreteHolidays::ChristmasObserved
    add_holiday ConcreteHolidays::NewYearsEve
  end
end

holidays = MyHolidays.new
holidays.holiday?(date)

Create a custom holiday (class)

The class must implement self.date(year) and return a date or array of dates.

class MyBirthday
  def self.date(year)
    Date.new(year,3,14)
  end
end

holidays = ConcreteHolidays.new
holidays.add_holiday MyBirthday
holidays.holiday?(date)

Create a custom holiday (instance)

The instance must respond to date(year) and return a date or array of dates.

class MyBirthday
  def date(year)
    Date.new(year,3,14)
  end
end

holidays = ConcreteHolidays.new
holidays.add_holiday MyBirthday.new
holidays.holiday?(date)

FAQs

Package last updated on 17 Apr 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc