Class: When::Coordinates::Index

Inherits:
BasicTypes::Object show all
Defined in:
lib/when_exe/coordinates.rb

Overview

暦座標

暦座標の特性を定義する

Constant Summary

Constants included from Parts::Resource

Parts::Resource::ConstList, Parts::Resource::ConstTypes, Parts::Resource::IRIDecode, Parts::Resource::IRIDecodeTable, Parts::Resource::IRIEncode, Parts::Resource::IRIEncodeTable, Parts::Resource::IRIHeader, Parts::Resource::LabelProperty

Instance Attribute Summary collapse

Attributes inherited from BasicTypes::Object

#label

Attributes included from Parts::Resource

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

Class Method Summary collapse

Methods included from Parts::Resource

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

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 Attribute Details

#baseInteger (readonly)

日時要素の下限

Returns:

  • (Integer)

    年月日は 1, 時分秒は 0



659
660
661
# File 'lib/when_exe/coordinates.rb', line 659

def base
  @base
end

#branchHash (readonly)

日時要素名(枝)

Returns:

  • (Hash)

    { Numeric=>When::BasicTypes::M17n }

    When::Coordinates::Pair の branch の値からprefix

    (「閏」などの文字列)を引くための Hash



687
688
689
# File 'lib/when_exe/coordinates.rb', line 687

def branch
  @branch
end

#indexHash (readonly)

インデクス(幹枝)

Returns:

  • (Hash)

    { String=>When::Coordinates::Pair }

    日時要素名から When::Coordinates::Pair を引くための Hash

    初期化時に @trunk, @branch から自動的に生成する



707
708
709
# File 'lib/when_exe/coordinates.rb', line 707

def index
  @index
end

#shiftInteger (readonly)

座標値のシフト

Returns:

  • (Integer)

    (デフォルト 0)

    月 - 名称を trunk 配列の何番目(0オリジン)からとるかを指定

    日 - 剰余類のシフトを指定



677
678
679
# File 'lib/when_exe/coordinates.rb', line 677

def shift
  @shift
end

#trunkWhen::BasicTypes::M17n (readonly)

日時要素名(幹)

Returns:



667
668
669
# File 'lib/when_exe/coordinates.rb', line 667

def trunk
  @trunk
end

#trunk_branchHash (readonly)

日時要素名(幹枝)

Returns:

  • (Hash)

    { When::Coordinates::Pair=>When::BasicTypes::M17n }

    When::Coordinates::Pair から 日時要素名を引くための Hash

    初期化時に @trunk, @branch から自動的に生成する



697
698
699
# File 'lib/when_exe/coordinates.rb', line 697

def trunk_branch
  @trunk_branch
end

#unitInteger (readonly)

日時要素の要素数

Returns:

  • (Integer)

    「時」なら 24, 「分」なら 60

    日数や太陰太陽暦の月数のように不定の場合は nil



651
652
653
# File 'lib/when_exe/coordinates.rb', line 651

def unit
  @unit
end

Class Method Details

.precision(specification) ⇒ Object



710
711
712
713
# File 'lib/when_exe/coordinates.rb', line 710

def self.precision(specification)
  return specification.to_i if (specification.kind_of?(Numeric))
  return (PRECISION[specification] || VALUE[specification] || When::SYSTEM)
end