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

holidays_img

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

holidays_img

  • 1.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

holidays_img

Gem Version

This gem is a simple wrapper for Rails's image_tag helper. Leveraging the holidays gem, it allows you to easily load images based on the holiday occurring on any given date.

Installation

Add the gem to your application's Gemfile:

gem 'holidays_img'

And then execute:

$ bundle

Usage

Simply use the holidays_image_tag helper as you would a standard Rails image_tag:

<%= holidays_image_tag 'image.jpg' %>

To ensure proper loading of images, adhere to the following naming convention:

  • Have a default image, used for when a day does not fall on a holiday (also acts as a fallback for when a holiday image cannot be found)
  • Name your holiday images in the following format: original_name_holiday_name.ext
  • Ensure all holiday images are in the same directory

Naming Example:

image.jpg
image_christmas_day.jpg
image_new_year_s_day.jpg
image_independence_day.jpg
...

See the Holidays gem's definition files for a list of holidays for any available region.

Configuration

You can configure options using an initializer:

# config/initializers/holidays_img.rb

HolidaysImg.configure do |config|
  # Load holidays based on region, defaults to :us
  config.region    = :ca
  # Only load images for holidays you specify
  config.whitelist = ['Christmas Day', 'Mother\'s Day']
  # Load custom holidays from file, can also pass array of file paths
  config.custom_holidays = '/path/to/custom_holidays.yml'
end

For info on how to format custom holiday definitions, see the Holidays gem's definition syntax documentation.

License

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

FAQs

Package last updated on 23 Nov 2016

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