Sha256: f1063df7b650466499537e61ccf86ef1dc4acd51548dd83389cf815d1ce192e7
Contents?: true
Size: 527 Bytes
Versions: 3
Compression:
Stored size: 527 Bytes
Contents
# -*- coding: utf-8 -*- require 'yaml' module HolidayJp class Holidays attr_accessor :holidays def initialize @holidays = {} yaml = YAML.load_file(File.expand_path('../../../holidays.yml', __FILE__)) yaml.map do |key, value| @holidays[key] = Holiday.new(key, value) end end def between(start, last) holidays.find_all do |date, _holiday| start <= date && date <= last end.map(&:last) end def holiday?(date) holidays[date] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
holiday_jp-0.5.1 | lib/holiday_jp/holidays.rb |
holiday_jp-0.5.0 | lib/holiday_jp/holidays.rb |
holiday_jp-0.4.3 | lib/holiday_jp/holidays.rb |