when_exe 0.4.6 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE.ja.txt +8 -21
  3. data/LICENSE.txt +5 -27
  4. data/README.md +8 -63
  5. data/bin/make_ttl.rb +3 -2
  6. data/bin/make_ttl.rb.config +3 -3
  7. data/lib/when_exe.rb +8 -3
  8. data/lib/when_exe/basictypes.rb +1 -2
  9. data/lib/when_exe/calendarnote.rb +9 -5
  10. data/lib/when_exe/calendartypes.rb +4 -4
  11. data/lib/when_exe/coordinates.rb +14 -18
  12. data/lib/when_exe/ephemeris.rb +5 -6
  13. data/lib/when_exe/events.rb +7 -7
  14. data/lib/when_exe/google_api.rb +26 -31
  15. data/lib/when_exe/icalendar.rb +8 -8
  16. data/lib/when_exe/inspect.rb +3 -3
  17. data/lib/when_exe/linkeddata.rb +10 -2
  18. data/lib/when_exe/locales/locale.rb +2 -2
  19. data/lib/when_exe/parts/enumerator.rb +3 -3
  20. data/lib/when_exe/parts/geometric_complex.rb +2 -2
  21. data/lib/when_exe/parts/resource.rb +2 -2
  22. data/lib/when_exe/parts/timezone.rb +17 -29
  23. data/lib/when_exe/region/balinese.rb +5 -3
  24. data/lib/when_exe/region/chinese.rb +25 -3
  25. data/lib/when_exe/region/chinese/twins.rb +128 -5
  26. data/lib/when_exe/region/dee.rb +4 -4
  27. data/lib/when_exe/region/geologicalage.rb +137 -126
  28. data/lib/when_exe/region/hanke_henry.rb +4 -4
  29. data/lib/when_exe/region/indian.rb +73 -4
  30. data/lib/when_exe/region/international_fixed.rb +3 -3
  31. data/lib/when_exe/region/japanese.rb +9 -5
  32. data/lib/when_exe/region/japanese/epochs.rb +8 -4
  33. data/lib/when_exe/region/japanese/notes.rb +25 -7
  34. data/lib/when_exe/region/japanese/residues.rb +32 -10
  35. data/lib/when_exe/region/japanese/weeks.rb +7 -7
  36. data/lib/when_exe/region/korean.rb +17 -17
  37. data/lib/when_exe/region/saudi_arabian.rb +57 -0
  38. data/lib/when_exe/region/world.rb +3 -3
  39. data/lib/when_exe/timestandard.rb +7 -5
  40. data/lib/when_exe/tmobjects.rb +2 -2
  41. data/lib/when_exe/tmposition.rb +6 -4
  42. data/lib/when_exe/tmreference.rb +3 -3
  43. data/lib/when_exe/version.rb +3 -3
  44. data/test/events/example-datasets +0 -1
  45. data/test/events/japanese-holiday.csv +23 -6
  46. data/test/events/japanese-holiday.ttl +321 -151
  47. data/test/test/basictypes.rb +2 -2
  48. data/test/test/calendarnote.rb +2 -2
  49. data/test/test/coordinates.rb +6 -4
  50. data/test/test/ephemeris.rb +2 -2
  51. data/test/test/google_api.rb +45 -32
  52. data/test/test/inspect.rb +2 -2
  53. data/test/test/parts.rb +5 -5
  54. data/test/test/region/christian.rb +7 -7
  55. data/test/test/region/indian.rb +14 -1
  56. data/test/test/region/islamic.rb +11 -1
  57. data/test/test/region/japanese.rb +3 -3
  58. data/test/test/region/m17n.rb +2 -2
  59. data/test/test/region/reforms.rb +2 -2
  60. data/test/test/tmposition.rb +7 -7
  61. metadata +7 -8
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2015-2016 Takashi SUGA
3
+ Copyright (C) 2015-2021 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license
6
6
  described in the LICENSE.txt file included in this archive.
@@ -1160,9 +1160,9 @@ module When
1160
1160
  edge_included(first, range.send(method), :to_f))
1161
1161
  end
1162
1162
  end
1163
- elsif @index.key?(SPATIAL)
1164
- list << @index[SPATIAL][options['location']]
1165
- end
1163
+ elsif @index.key?(SPATIAL)
1164
+ list << @index[SPATIAL][options['location']]
1165
+ end
1166
1166
  end
1167
1167
 
1168
1168
  # グラフ
@@ -1440,7 +1440,7 @@ module When
1440
1440
  when /(out|no)\s*header\s*(\((\d+)\))?/i
1441
1441
  @limit = $3.to_i if $3
1442
1442
  csv_row_vs_label([])
1443
- open(source,'r') do |io|
1443
+ ::URI.send(:open, source,'r') do |io|
1444
1444
  CSV.parse(io.read) do |row|
1445
1445
  yield(row)
1446
1446
  break if @limit && @events.size >= @limit
@@ -1448,7 +1448,7 @@ module When
1448
1448
  end
1449
1449
  when /header\s*(\((\d+)\))?/i
1450
1450
  @limit = $2.to_i if $2
1451
- open(source,'r') do |io|
1451
+ ::URI.send(:open, source,'r') do |io|
1452
1452
  CSV.parse(io.read) do |row|
1453
1453
  if @row_vs_label
1454
1454
  yield(row)
@@ -1478,7 +1478,7 @@ module When
1478
1478
  @limit = $3.to_i if $3
1479
1479
  rexp = Regexp.compile($1)
1480
1480
  csv_row_vs_label([])
1481
- open(source, 'r') do |file|
1481
+ ::URI.send(:open, source, 'r') do |file|
1482
1482
  file.read.gsub(/[\r\n]/,'').scan(rexp) do
1483
1483
  yield((1...$~.size).to_a.map {|i| $~[i]})
1484
1484
  end
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2015 Takashi SUGA
3
+ Copyright (C) 2015-2021 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
@@ -8,7 +8,8 @@
8
8
  #
9
9
  # GoogleAPI の Calendar API v3 への対応
10
10
  #
11
- # see {Google Calendar API Reference https://developers.google.com/google-apps/calendar/v3/reference/}
11
+ # see {Ruby Quickstart https://developers.google.com/calendar/quickstart/ruby}
12
+ # see {Simple REST client for version V3 of the Calendar API https://googleapis.dev/ruby/google-apis-calendar_v3/v0.1.0/}
12
13
  #
13
14
  module When::GoogleAPI
14
15
 
@@ -17,15 +18,9 @@ module When::GoogleAPI
17
18
  #
18
19
  class Calendar
19
20
 
20
- # APIClient のインスタンス
21
- #
22
- # @return [Google::APIClient]
23
- #
24
- attr_reader :client
25
-
26
21
  # Calendar API のインスタンス
27
22
  #
28
- # @return [Google::APIClient::API]
23
+ # @return [Google::Apis::CalendarV3::CalendarService]
29
24
  #
30
25
  attr_reader :service
31
26
 
@@ -45,24 +40,19 @@ module When::GoogleAPI
45
40
  #
46
41
  # GoogleAPI の Calendar を生成する
47
42
  #
48
- # @param [Google::APIClient] client
49
- # @param [Google::APIClient::API] service
43
+ # @param [Google::Apis::CalendarV3::CalendarService] service
50
44
  # @param [String] calendar_id
51
45
  #
52
- def list(client, service, calendar_id)
46
+ def list(service, calendar_id)
53
47
  events = []
54
- result = client.execute({:api_method => service.events.list,
55
- :parameters => {'calendarId' => calendar_id}})
48
+ result = service.list_events(calendar_id)
56
49
  loop do
57
- events += result.data.items.map {|event| event.to_hash}
58
- page_token = result.data.next_page_token
50
+ events += result.items.map {|event| event.to_h}
51
+ page_token = result.next_page_token
59
52
  break unless page_token
60
- result = client.execute({:api_method => service.events.list,
61
- :parameters => {'calendarId' => calendar_id,
62
- 'pageToken' => page_token}})
53
+ result = service.list_events(calendar_id, page_token: page_token)
63
54
  end
64
55
  calendar = new(events)
65
- calendar.instance_variable_set(:@client, client)
66
56
  calendar.instance_variable_set(:@service, service)
67
57
  calendar.instance_variable_set(:@calendar_id, calendar_id)
68
58
  calendar
@@ -87,7 +77,7 @@ module When::GoogleAPI
87
77
  #
88
78
  def initialize(events)
89
79
  @events = events.map {|event|
90
- next nil unless event['status'] == 'confirmed'
80
+ next nil unless event[:status] == 'confirmed'
91
81
  When::V::Event.new(event)
92
82
  }.compact
93
83
  end
@@ -114,15 +104,18 @@ class When::V::Event
114
104
  iprops = {}
115
105
  gprops.each_pair do |key, value|
116
106
  case key
117
- when 'summary'
118
- iprops['summary'] = value
119
- when 'start', 'end'
107
+ when :start, :end
120
108
  date = 'VALUE=DATE'
121
- date += '-TIME' if value.key?('dateTime')
122
- date += ';TZID=' + value['timeZone'] if value.key?('timeZone')
123
- date += ':' + (value['date'] || value['dateTime'])
124
- iprops['dt' + key] = date
125
- when 'recurrence'
109
+ if value.key?(:date)
110
+ date += ':' + value[:date].strftime('%Y%m%d')
111
+ else
112
+ date += '-TIME'
113
+ date += ':' + value[:date_time].strftime('%Y%m%dT%H%M%S')
114
+ date += value[:date_time].strftime('%z') unless value[:time_zone]
115
+ end
116
+ date.sub!(':', ";TZID=#{value[:time_zone]}:") if value.key?(:time_zone)
117
+ iprops['dt' + key.to_s] = date
118
+ when :recurrence
126
119
  value.map do |line|
127
120
  tag, rule = line.split(':', 2)
128
121
  tag.downcase!
@@ -132,8 +125,10 @@ class When::V::Event
132
125
  iprops[tag] = rule
133
126
  end
134
127
  end
135
- when 'iCalUID'
128
+ when :i_cal_uid
136
129
  iprops['uid'] = value
130
+ when Symbol
131
+ iprops[key.to_s] = value
137
132
  end
138
133
  end
139
134
  iprops
@@ -144,7 +139,7 @@ class When::V::Event
144
139
 
145
140
  # Hash からの属性読み込み
146
141
  def _parse_from_code(options)
147
- if options.key?('start')
142
+ if options.key?(:start)
148
143
  @google_api_props = options
149
144
  options = self.class.gcal2ical(options)
150
145
  end
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2011-2016 Takashi SUGA
3
+ Copyright (C) 2011-2021 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
@@ -574,7 +574,7 @@ module When::V
574
574
  #
575
575
  # @return [When::TM::IntervalLength]
576
576
  def default_until
577
- @default_until ||= 1000*When::TM::Duration::YEAR
577
+ @default_until ||= 1000*(When::TM::Duration::YEAR / When::TM::Duration::DAY)
578
578
  end
579
579
 
580
580
  # ISO8601へ埋め込まれた指定に対応する iterator を生成する
@@ -1047,13 +1047,13 @@ module When::V
1047
1047
  super
1048
1048
 
1049
1049
  @child.each do |prop|
1050
- @dtstart = prop.dtstart if (@dtstart==nil || prop.dtstart < @dtstart)
1050
+ @dtstart = prop.dtstart if (@dtstart.nil? || prop.dtstart < @dtstart)
1051
1051
  @dtstop = prop.dtstop unless (prop.dtstop.kind_of?(When::TimeValue) &&
1052
1052
  @dtstop.kind_of?(When::TimeValue) &&
1053
1053
  prop.dtstop <= @dtstop)
1054
1054
  [prop.tzoffsetfrom, prop.tzoffsetto].each do |tz|
1055
- @daylight = tz if (@daylight==nil || tz.universal_time < @daylight.universal_time)
1056
- @standard = tz if (@standard==nil || tz.universal_time > @standard.universal_time)
1055
+ @daylight = tz if (@daylight.nil? || tz.universal_time < @daylight.universal_time)
1056
+ @standard = tz if (@standard.nil? || tz.universal_time > @standard.universal_time)
1057
1057
  end
1058
1058
  end
1059
1059
  @tz_difference = @standard.universal_time - @daylight.universal_time
@@ -1107,7 +1107,7 @@ module When::V
1107
1107
  date = prop.enum_for(current_time, direction, 1).succ
1108
1108
  if (date)
1109
1109
  diff = (date.universal_time - current_time).abs
1110
- if (minimum == nil || minimum > diff)
1110
+ if (minimum.nil? || minimum > diff)
1111
1111
  event = date
1112
1112
  minimum = diff
1113
1113
  end
@@ -1402,7 +1402,7 @@ module When::V
1402
1402
  if (dtstart && dtstart.has_time?)
1403
1403
  ['HOUR', 'MINUTE', 'SECOND'].each do |part|
1404
1404
  by_part = 'BY' + part
1405
- if (rule[by_part]==nil && freq_index && freq_index < PostFreqIndex[by_part])
1405
+ if (rule[by_part].nil? && freq_index && freq_index < PostFreqIndex[by_part])
1406
1406
  base = dtstart[PostFreqIndex[by_part]]
1407
1407
  rule[by_part] = Logic.const_get(part.capitalize).new(by_part, base) unless (base == 0)
1408
1408
  end
@@ -1604,7 +1604,7 @@ module When::V
1604
1604
  nth, spec, period = ord
1605
1605
  shift = (period[PostFreqIndex[@by_part]] != 0)
1606
1606
  raise ArgumentError, "n*e+/-s format not permitted" if (nth || shift) && @freq_index >= When::DAY
1607
- if (nth==nil || nth>0)
1607
+ if (nth.nil? || nth>0)
1608
1608
  enum = @ref.enum_for(lower_bound, :forward, {:event=>spec})
1609
1609
  else
1610
1610
  enum = @ref.enum_for(higher_bound, :reverse, {:event=>spec})
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2011-2016 Takashi SUGA
3
+ Copyright (C) 2011-2021 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
@@ -75,7 +75,7 @@ module When
75
75
  # @return [String] to_h 結果を JSON文字列化したもの
76
76
  #
77
77
  def to_json(options={})
78
- options[:method] = :to_m17n unless options.key?(:method)
78
+ options[:method] = :to_m17n unless options.respond_to?(:key?) && options.key?(:method)
79
79
  JSON.dump(to_h(options))
80
80
  end
81
81
 
@@ -603,7 +603,7 @@ module When
603
603
  form_options[:method] = :to_m17n unless form_options.key?(:method)
604
604
  persistence = options.delete(:persistence) if options.kind_of?(Hash)
605
605
  retrieved = When::CalendarNote::NotesContainer.retrieve(persistence, self.to_i)
606
- return retrieved unless retrieved == false
606
+ return retrieved if retrieved
607
607
  When::CalendarNote::NotesContainer.register(_m17n_form(_notes(options), form_options), persistence, self.to_i)
608
608
  end
609
609
 
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2014-2016 Takashi SUGA
3
+ Copyright (C) 2014-2021 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
@@ -379,6 +379,7 @@ module When
379
379
  # namespace を prefix にコンパクト化する
380
380
  #
381
381
  def compact_namespace_to_prefix(source, prefixes, context=nil)
382
+ return source.map {|element| compact_namespace_to_prefix(element, prefixes, context)} if source.kind_of?(Array)
382
383
  return source unless prefixes
383
384
  prefixes.each_pair do |key, value|
384
385
  Array(value).each do |namespace|
@@ -574,7 +575,14 @@ module When
574
575
  value =_value_str(note[:note], note[:value])
575
576
  end
576
577
  id = compact_namespace_to_prefix(value, options[:prefixes], context)
577
- hash[compact_namespace_to_prefix(_note_str(note[:note]), options[:prefixes], context)] = (id == value && id !~ /:\/\//) ? id : {'@id'=>id}
578
+ if id.kind_of?(Array)
579
+ (0...id.length).each do |i|
580
+ id[i] = {'@id'=>id[i]} unless id[i] == value[i] && id[i] !~ /:\/\//
581
+ end
582
+ else
583
+ id = {'@id'=>id} unless id == value && id !~ /:\/\//
584
+ end
585
+ hash[compact_namespace_to_prefix(_note_str(note[:note]), options[:prefixes], context)] = id
578
586
  end
579
587
  hash
580
588
  end
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2011-2015 Takashi SUGA
3
+ Copyright (C) 2011-2021 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
@@ -370,7 +370,7 @@ module When
370
370
  contents = nil
371
371
  begin
372
372
  OpenURI
373
- source = open(path, 'r'+mode, {:ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE})
373
+ source = URI.send(:open, path, 'r'+mode, {:ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE})
374
374
  contents = source.read
375
375
  ensure
376
376
  @wikipedia_last_access = Time.now.to_f
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2011-2015 Takashi SUGA
3
+ Copyright (C) 2011-2021 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
@@ -313,7 +313,7 @@ module When::Parts
313
313
  end
314
314
  end
315
315
  previous = @processed._include?(value)
316
- @processed |= value if previous == false
316
+ @processed |= value unless previous
317
317
  registered = (previous==value) ? previous : value
318
318
  registered = registered.first if registered.kind_of?(GeometricComplex)
319
319
  registered.events ||=[]
@@ -352,7 +352,7 @@ module When::Parts
352
352
  # eql? はオーバーライドしない
353
353
  #
354
354
  def self._sort(list, direction)
355
- list = list.sort
355
+ list = (0...list.size).to_a.map {|i| [list[i], i]}.sort.map {|e| e[0]}
356
356
  prev = nil
357
357
  list.delete_if do |x|
358
358
  if (x == prev)
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2011-2015 Takashi SUGA
3
+ Copyright (C) 2011-2021 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
@@ -266,7 +266,7 @@ module When::Parts
266
266
  #
267
267
  # @return [When::Parts::GeometricComplex]
268
268
  #
269
- def +(duration)
269
+ def -(duration)
270
270
  self.class.new(@node.map {|node|
271
271
  new_node = node.dup
272
272
  new_node[0] -= duration
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2011-2016 Takashi SUGA
3
+ Copyright (C) 2011-2021 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
@@ -558,7 +558,7 @@ module When::Parts
558
558
  raise IOError, path + ': not ready' unless real_path
559
559
  args = [real_path, "1".respond_to?(:force_encoding) ? 'r:utf-8' : 'r']
560
560
  args << {:ssl_verify_mode=>OpenSSL::SSL::VERIFY_NONE} if real_path =~ /\Ahttps:/
561
- open(*args) do |file|
561
+ URI.send(:open,*args) do |file|
562
562
  resource = file.read
563
563
  case resource[0..5].upcase
564
564
  when 'BEGIN:'
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2011-2016 Takashi SUGA
3
+ Copyright (C) 2011-2020 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
@@ -152,28 +152,16 @@ module When::Parts
152
152
  @identifier = identifier
153
153
  id, query = identifier.split('?', 2)
154
154
  @timezone = TZInfo::Timezone.get(id.sub(/\(.+?\)\z/,''))
155
- unless TZInfo::TimeOrDateTime.method_defined?(:_to_datetime)
156
- if TZInfo::RubyCoreSupport.respond_to?(:datetime_new)
157
- TZInfo::TimeOrDateTime.class_eval %Q{
158
- alias :_to_datetime :to_datetime
159
- ::Rational
160
- def to_datetime
161
- unless @datetime
162
- u = usec
163
- s = u == 0 ? sec : Rational(sec * 1000000 + u, 1000000)
164
- @datetime = TZInfo::RubyCoreSupport.datetime_new(year, mon, mday, hour, min, s, 0, Date::GREGORIAN)
165
- end
166
- @datetime
167
- end
168
- }
169
- else
170
- TZInfo::TimeOrDateTime.class_eval %Q{
171
- alias :_to_datetime :to_datetime
172
- def to_datetime
173
- @datetime ||= DateTime.new(year, mon, mday, hour, min, sec, 0, Date::GREGORIAN)
174
- end
175
- }
176
- end
155
+ unless TZInfo::Timezone.method_defined?(:period_for)
156
+ TZInfo::Timezone.class_eval %Q{
157
+ def period_for(time)
158
+ period_for_utc(Time.at(time).getutc)
159
+ end
160
+ }
161
+ TZInfo::TimezonePeriod.class_eval %Q{
162
+ alias :starts_at :utc_start
163
+ alias :ends_at :utc_end
164
+ }
177
165
  end
178
166
  dst, std = _offsets(Time.now.to_i)
179
167
  options = query ? Hash[*(query.split('&').map {|item| item.split('=',2)}.flatten)] : {}
@@ -204,11 +192,11 @@ module When::Parts
204
192
  offsets = _offsets((time/When::TM::Duration::SECOND).floor)
205
193
  offsets.each do |offset|
206
194
  clocks[offset] ||= When::TM::Clock.new(options.merge({:zone=>offset, :tz_prop=>self}))
207
- return clocks[offsets[0]] if @timezone.period_for_utc(
208
- (frame.to_universal_time(cal_date, clk_time, clocks[offset])/When::TM::Duration::SECOND).floor).dst?
195
+ time_for_offset = frame.to_universal_time(cal_date, clk_time, clocks[offset])
196
+ return clocks[offsets[0]] if @timezone.period_for(Time.at((time_for_offset/When::TM::Duration::SECOND).floor)).dst?
209
197
  end
210
198
  end
211
- offset = @timezone.period_for_utc((time/When::TM::Duration::SECOND).floor).utc_total_offset
199
+ offset = @timezone.period_for(Time.at((time/When::TM::Duration::SECOND).floor)).utc_total_offset
212
200
  clocks[offset] || When::TM::Clock.new(options.merge({:zone=>offset, :tz_prop=>self}))
213
201
  end
214
202
 
@@ -220,9 +208,9 @@ module When::Parts
220
208
  private
221
209
 
222
210
  def _offsets(time)
223
- now = @timezone.period_for_utc(time)
224
- past = @timezone.period_for_utc(now.utc_start-1) if now.utc_start
225
- future = @timezone.period_for_utc(now.utc_end) if now.utc_end
211
+ now = @timezone.period_for(Time.at(time))
212
+ past = @timezone.period_for(Time.at(now.starts_at.to_time.to_i-1)) if now.starts_at
213
+ future = @timezone.period_for( now.ends_at .to_time ) if now.ends_at
226
214
  std = now.utc_offset
227
215
  dst = now.utc_total_offset
228
216
  [past, future].each do |period|
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2011-2015 Takashi SUGA
3
+ Copyright (C) 2011-2019 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
@@ -135,7 +135,7 @@ module When
135
135
  BalineseLuniSolar = [self, [
136
136
  "locale:[=en:, ja=ja:, zh=zh:, alias]",
137
137
  "period:[BalineseLuniSolar=, バリ・サカ暦=, 峇里陰陽曆=]",
138
- ["[SE=, サカ暦=, 塞種紀元=, alias:Balinese_Saka_Era]1887-07<13", '@CE', "1965-07<13^BalineseLuniSolar1965",
138
+ ["[SE=, サカ暦=, 塞種紀元=, alias:Balinese_Saka_Era]1888-10-01", '@CE', "1966-10-01^BalineseLuniSolar1965",
139
139
  "1971-07-04^BalineseLuniSolar1971",
140
140
  "1993-07-08^BalineseLuniSolar1993",
141
141
  "1999-06<10^BalineseLuniSolar2000",
@@ -198,7 +198,9 @@ module When
198
198
  +1.5 => intercalary_month[3]}, # 閏黒分
199
199
  :shift=>+8})
200
200
 
201
- @origin_of_MSC = 0
201
+ @origin_of_MSC ||= 0
202
+
203
+ @label ||= 'Balinese::BalineseLuniSolar'
202
204
 
203
205
  @tabular = CyclicTableBased.new({
204
206
  'indices' => [month_index, When::Coordinates::DefaultDayIndex],