Class: When::Coordinates::Kyusei

Inherits:
Residue show all
Defined in:
lib/when_exe/region/residue.rb,
lib/when_exe/region/japanese/residues.rb

Overview

九星

Constant Summary collapse

StartOfSequence =
{-1=>'九星陽遁始め', +1=>'九星陰遁始め'}

Constants inherited from Residue

Residue::HashProperty, Residue::LabelProperty

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

Attributes inherited from Residue

#carry, #divisor, #remainder, #units

Attributes inherited from BasicTypes::Object

#label

Attributes included from Parts::Resource

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

Class Method Summary collapse

Methods inherited from Residue

#%, #&, #+, #-, #<<, #>>, #[], _china, #_column_for_week_included, _day_of_week, #_enumerator, #_range_for_week_included, day_of_week, #difference, #duration, #event, #initialize, mod, #to, #to_m17n, #to_s

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

Constructor Details

This class inherits a constructor from When::Coordinates::Residue

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class When::Coordinates::Residue

Class Method Details

.day(date, s_terms) ⇒ Integer

日の九星のインデックス

Parameters:

Returns:

  • (Integer)


49
50
51
52
53
# File 'lib/when_exe/region/japanese/residues.rb', line 49

def day(date, s_terms)
  thres, delta, sign = _parameters(date, s_terms)
  delta = 8 - delta if sign < 0
  return delta % 9
end

.is_turn?(date, s_terms) ⇒ String

陰遁・陽遁折り返し日か?

Parameters:

Returns:



63
64
65
66
67
# File 'lib/when_exe/region/japanese/residues.rb', line 63

def is_turn?(date, s_terms)
  thres, delta, sign = _parameters(date, s_terms)
  return nil unless thres == delta
  StartOfSequence[sign]
end

.month(m) ⇒ Integer

月の九星のインデックス

Parameters:

  • m (Integer)

    通月

Returns:

  • (Integer)


37
38
39
# File 'lib/when_exe/region/japanese/residues.rb', line 37

def month(m)
  (m + 2) % 9
end

.year(y) ⇒ Integer

年の九星のインデックス

Parameters:

  • y (Integer)

    西暦の年数

Returns:

  • (Integer)


26
27
28
# File 'lib/when_exe/region/japanese/residues.rb', line 26

def year(y)
  (y + 2) % 9
end