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::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

#[], #^, _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



640
641
642
# File 'lib/when_exe/coordinates.rb', line 640

def base
  @base
end

#branchHash (readonly)

日時要素名(枝)

Returns:

  • (Hash)

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

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

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



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

def branch
  @branch
end

#indexHash (readonly)

インデクス(幹枝)

Returns:

  • (Hash)

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

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

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



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

def index
  @index
end

#shiftInteger (readonly)

座標値のシフト

Returns:

  • (Integer)

    (デフォルト 0)

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

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



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

def shift
  @shift
end

#trunkWhen::BasicTypes::M17n (readonly)

日時要素名(幹)

Returns:



648
649
650
# File 'lib/when_exe/coordinates.rb', line 648

def trunk
  @trunk
end

#trunk_branchHash (readonly)

日時要素名(幹枝)

Returns:

  • (Hash)

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

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

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



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

def trunk_branch
  @trunk_branch
end

#unitInteger (readonly)

日時要素の要素数

Returns:

  • (Integer)

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

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



632
633
634
# File 'lib/when_exe/coordinates.rb', line 632

def unit
  @unit
end

Class Method Details

.precision(specification) ⇒ Object



691
692
693
694
# File 'lib/when_exe/coordinates.rb', line 691

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