Class: When::CalendarTypes::Border

Inherits:
TM::ReferenceSystem show all
Defined in:
lib/when_exe/calendartypes.rb

Overview

日時要素の境界 - Border

Direct Known Subclasses

DayBorder, Easter, MultiBorder

Constant Summary

Constants included from Parts::Resource

Parts::Resource::LabelProperty

Instance Attribute Summary

Attributes inherited from TM::ReferenceSystem

#domain_of_validity, #position

Attributes inherited from BasicTypes::Object

#label

Attributes included from Parts::Resource

#_pool, #child, #keys, #locale, #namespace

Instance Method Summary collapse

Methods inherited from TM::ReferenceSystem

#domain, #name

Methods included from Parts::Resource

#[], #^, _decode, _encode, _extract_prefix, _instance, _parse, _path_with_prefix, _replace_tags, _setup_, #each, #enum_for, #hierarchy, #include?, #included?, #iri, #leaf?, #m17n, #map, #next, #parent, #prev, #registered?

Methods included from Parts::Resource::Pool

#[], #[]=, #_pool, #_setup_, #pool_keys

Methods included from Parts::Resource::Synchronize

#synchronize

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class When::Parts::Resource

Instance Method Details

#_adjust_epoch(date, frame = nil) ⇒ Array<Numeric>

境界の正規化


949
950
951
952
953
954
955
956
# File 'lib/when_exe/calendartypes.rb', line 949

def _adjust_epoch(date, frame=nil)
  s_date  = date.dup
  e_date  = border(date[0..0], frame)
  branch  = behavior * 0
  branch += 1 if ((s_date[1..-1] <=> e_date[1..-1]) < 0)
  s_date[0] = When::Coordinates::Pair.new(+s_date[0]-branch, branch)
  return s_date
end

#behaviorNumeric

境界の振舞


921
922
923
# File 'lib/when_exe/calendartypes.rb', line 921

def behavior
  @border[0]
end

#border(date = [], frame = nil) ⇒ Array<Numeric>

境界の取得


932
933
934
935
936
937
938
939
940
# File 'lib/when_exe/calendartypes.rb', line 932

def border(date=[], frame=nil)
  last = date.length-1
  return @border if (last<0)
  bDate  = date[0..last] + @border[(last+1)..-1]
  branch = @border[last] * 0
  return bDate if (branch==0)
  bDate[last] = When::Coordinates::Pair.new(+date[last]-branch, branch)
  return bDate
end