Sha256: 71b75333246e530248ba76194af75e9e6590a6ed2855935fbf900ae03211d9a9
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true require 'japanese_calendar/deprecator' module JapaneseCalendar module Era module Deprecator include JapaneseCalendar::Deprecator DEPRECATIONS = { '%K' => 'Please use %JN instead.', '%O' => 'Please use %JR instead.', '%^O' => 'Please use %^JR instead.', '%o' => 'Please use %Jr instead.', '%J' => 'Please use %Jy instead.', '%-J' => 'Please use %-Jy instead.', '%_J' => 'Please use %_Jy instead.' }.freeze private_constant :DEPRECATIONS def strftime(format) deprecations = collect_era_deprecations(format) deprecations.each { |deprecation| deprecate(*deprecation) } super(format) end private def collect_era_deprecations(format) deprecation_pattern = Regexp.union(DEPRECATIONS.keys) deprecated_directives = format.scan(deprecation_pattern).uniq DEPRECATIONS.select do |directive, _| deprecated_directives.include?(directive) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
japanese_calendar-0.4.1 | lib/japanese_calendar/era/deprecator.rb |