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

#baseInteger (readonly)

日時要素の下限

Returns:

  • (Integer)

    年月日は 1, 時分秒は 0


612
613
614
# File 'lib/when_exe/coordinates.rb', line 612

def base
  @base
end

#branchHash (readonly)

日時要素名(枝)

Returns:

  • (Hash)

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

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

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


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

def branch
  @branch
end

#indexHash (readonly)

インデクス(幹枝)

Returns:

  • (Hash)

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

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

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


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

def index
  @index
end

#shiftInteger (readonly)

座標値のシフト

Returns:

  • (Integer)

    (デフォルト 0)

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

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


630
631
632
# File 'lib/when_exe/coordinates.rb', line 630

def shift
  @shift
end

#trunkWhen::BasicTypes::M17n (readonly)

日時要素名(幹)

Returns:


620
621
622
# File 'lib/when_exe/coordinates.rb', line 620

def trunk
  @trunk
end

#trunk_branchHash (readonly)

日時要素名(幹枝)

Returns:

  • (Hash)

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

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

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


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

def trunk_branch
  @trunk_branch
end

#unitInteger (readonly)

日時要素の要素数

Returns:

  • (Integer)

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

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


604
605
606
# File 'lib/when_exe/coordinates.rb', line 604

def unit
  @unit
end

Class Method Details

.precision(specification) ⇒ Object


663
664
665
666
# File 'lib/when_exe/coordinates.rb', line 663

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