Sha256: 32465b2d33b933d651ded6659dd2c0a82105923b6d6a2013cb682ace854463ba
Contents?: true
Size: 662 Bytes
Versions: 3
Compression:
Stored size: 662 Bytes
Contents
# frozen_string_literal: true module JapaneseCalendar module Weekday NAMES = %w(日曜日 月曜日 火曜日 水曜日 木曜日 金曜日 土曜日).freeze # Formats time according to the directives in the given format string. # # date_of_birth = Time.new(1978, 7, 19) # # date_of_birth.strftime("%Q") # => "水曜日" # date_of_birth.strftime("%q") # => "水" # # date_of_birth.strftime("%-Y年%-m月%-d日(%q)") # => "1978年7月19日(水)" def strftime(format) string = format.dup string.gsub!(/%Q/, NAMES[wday]) string.gsub!(/%q/, NAMES[wday][0]) super(string) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
japanese_calendar-0.3.2 | lib/japanese_calendar/weekday.rb |
japanese_calendar-0.3.1 | lib/japanese_calendar/weekday.rb |
japanese_calendar-0.3.0 | lib/japanese_calendar/weekday.rb |