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=>'九星陰遁始め'}
Patch =
{2421371=>2421431, 2429771=>2429831, 2463251=>2463191, 2475851=>2475791}

Constants inherited from Residue

Residue::LabelProperty

Constants included from Namespace

Namespace::DC, Namespace::DCQ, Namespace::DCT, Namespace::FOAF, Namespace::OWL, Namespace::RDF, Namespace::RDFC, Namespace::RDFS, Namespace::RSS, Namespace::XSD

Instance Attribute Summary

Attributes inherited from Residue

#carry, #divisor, #remainder, #shifted, #units

Attributes inherited from BasicTypes::Object

#label

Attributes included from Parts::Resource

#child, #keys, #locale, #namespace

Class Method Summary collapse

Methods inherited from Residue

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

Methods included from Parts::Resource

#[], #^, _instance, _setup_, _setup_info, base_uri, #each, #enum_for, #hierarchy, #include?, #included?, #iri, #leaf?, #m17n, #map, #parent, #registered?, root_dir

Methods included from Parts::Resource::Pool

#[], #[]=, #_setup_

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)


51
52
53
54
55
56
# File 'lib/when_exe/region/japanese/residues.rb', line 51

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

.is_turn?(date, s_terms) ⇒ String

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

Parameters:

Returns:



66
67
68
69
70
# File 'lib/when_exe/region/japanese/residues.rb', line 66

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)


39
40
41
# File 'lib/when_exe/region/japanese/residues.rb', line 39

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

.year(y) ⇒ Integer

年の九星のインデックス

Parameters:

  • y (Integer)

    西暦の年数

Returns:

  • (Integer)


28
29
30
# File 'lib/when_exe/region/japanese/residues.rb', line 28

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