Class Index [+]

Quicksearch

When::CalendarTypes::CyclicTableBased

年の配当パターンが限定されている暦

  Calendar which has some fixed arrangement rules of year pattern

Public Instance Methods

_key_(date) click to toggle source

暦日表のキー取得

  date    : [y]
    y - 年

  returns : 暦日表のキー
     # File when/calendartypes.rb, line 474
474:     def _key_(date)
475:       root_rule = @rule_table[@entry_key]
476:       count, value = date[0].divmod(root_rule['Years'])
477:       sdn, y, key  = _read_period(@entry_key,
478:                    'Years', value,
479:                    'Days',  @origin_of_LSD + count * root_rule['Days'])
480:       return key
481:     end
_number_to_coordinates(sdn) click to toggle source

通日 - > 年月日

  sdn     : 通日

  returns : [y, m, d]
    y     - 年
    m     - 月 (0 始まり)
    d     - 日 (0 始まり)
     # File when/calendartypes.rb, line 419
419:     def _number_to_coordinates(sdn)
420:       root_rule = @rule_table[@entry_key]
421:       count, value = (sdn-@origin_of_LSD).divmod(root_rule['Days'])
422:       y, d, key = _read_period(@entry_key, 
423:                 'Days',   value,
424:                 'Years',  count * root_rule['Years'])
425:       rule = _rule(key)
426:       (rule['Months']-1).downto(0) do |m|
427:         if d >=rule['Offset'][m]
428:           d -= rule['Offset'][m]
429:           return [y, m, d]
430:         end
431:       end
432:       return nil
433:     end
_sdn_(date) click to toggle source

年初の通日

  date    : [y]
    y - 年

  returns : 年初の通日
     # File when/calendartypes.rb, line 458
458:     def _sdn_(date)
459:       root_rule = @rule_table[@entry_key]
460:       count, value = date[0].divmod(root_rule['Years'])
461:       sdn, y, key  = _read_period(@entry_key,
462:                    'Years', value,
463:                    'Days',  @origin_of_LSD + count * root_rule['Days'])
464:       return sdn
465:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.