Skip to content
Browse files

Added some sugar to the ability to create comments for stuff.

  • Loading branch information...
1 parent 2982551 commit 9c24e87830ee4f627d0e352d4b73d3b377ccffd3 Tyler Gannon committed Mar 20, 2012
View
BIN app/assets/images/icons/delete-icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN app/assets/images/icons/edit-icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
8 app/assets/javascripts/comments.js.coffee
@@ -7,3 +7,11 @@ addComment = (comment) ->
$('#new_comment_form textarea').attr('value', '')
window.addComment = addComment
+
+$ ->
+ $('.comments_list[data-load-from]').each (index, element) ->
+ $.ajax(
+ dataType: 'script'
+ url: $(element).data('load-from')
+ )
+ # http://localhost:3000/stems_and_branches/water-monkey/comments.js
View
4 app/assets/stylesheets/app_main.css.scss
@@ -114,9 +114,9 @@ ul.nav_list {
margin: 0px;
&a {
display: block;
- width: 80px;
+ width: 190px;
padding: 4px;
- padding-left: 35px;
+ padding-left: 10px;
font-size: 13px;
text-decoration: none;
&:hover {
View
25 app/assets/stylesheets/comments.css.scss
@@ -1,3 +1,28 @@
// Place all the styles related to the comments controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
+
+
+.comment {
+ width: 500px;
+ border-style: solid;
+ border-color: #b2b2b2;
+ border-width: 1px;
+ position: relative;
+ padding: 4px;
+ .commentary {
+ width: 400px;
+ }
+ .edit_comment {
+ padding: 4px;
+ position: absolute;
+ top: 0;
+ left: 450px;
+ }
+ .delete_comment {
+ padding: 4px;
+ position: absolute;
+ top: 0;
+ left: 475px;
+ }
+}
View
11 app/assets/stylesheets/pillars.css.scss
@@ -0,0 +1,11 @@
+.stems_and_branches {
+ width: 720px;
+ height: 700px;
+ .branch {
+ width: 176px;
+ float: left;
+ border-style: solid;
+ border-width: 1px;
+ border-color: black;
+ }
+}
View
4 app/controllers/charts_controller.rb
@@ -1,3 +1,4 @@
+
class ChartsController < InheritedResources::Base
belongs_to :person
@@ -7,7 +8,6 @@ def show
end
@chart = parent.chart
@name = parent.full_name
-
respond_to do |format|
format.html
# format.html { render :layout => 'chart' }
@@ -17,5 +17,5 @@ def show
}
end
end
-end
+ end
View
1 app/controllers/comments_controller.rb
@@ -3,6 +3,7 @@ class CommentsController < InheritedResources::Base
belongs_to :star, :pillar, :polymorphic => true
before_filter :parent
before_filter :load_comment, :only => [:show, :edit, :update, :destroy]
+ helper_method :comments
def index
@comments = comments
View
6 app/controllers/pillars_controller.rb
@@ -2,9 +2,13 @@ class PillarsController < InheritedResources::Base
def show
@comments = comments
@new_comment = comments.build
+ @by_year = current_member.people.select{|person| person.chart.year == resource}
+ @by_hour = current_member.people.select{|person| person.chart.hour == resource}
end
def comments
- Comment.where(member_id: current_member.id, commentable_id: resource.id, commentable_type: 'Star')
+ Comment.where(member_id: current_member.id, commentable_id: resource.id, commentable_type: 'Pillar')
end
+
+ helper_method :parent
end
View
41 app/models/chart_ripper.rb
@@ -0,0 +1,41 @@
+# Grabs the lunar date and four pillars given a solar date and time.
+# This site returns info in HTML that looks like this:
+#
+# <TITLE>Chinese Calendar</TITLE>
+# <H1>solar to lunar calendar conversion </H1>
+# <PRE>
+# Lunar Version 2.1 (July 23, 1992)
+#
+# Solar : 1995.1.31.14 Tuesday
+# Lunar : 1995.1.1.14 ShengXiao: Pig
+# GanZhi: Yi3-Hai4.Wu4-Yin2.Ren2-Xu1.Ding1-Wei4
+# (GanZhi Order) 2-12.5-3.9-11.4-8
+# (JiaZi Cycle) 12.15.59.44
+#
+# BaZi (8-characters) according to 'Four Column Calculation':
+# Jia3-Xu1.Ding1-Chou3.Ren2-Xu1.Ding1-Wei4
+# (GanZhi Order) 1-11.4-2.9-11.4-8
+# (JiaZi Cycle) 11.14.59.44
+#
+#
+# -----
+# By: Fung F. Lee and Ricky Yeung
+# HTML interface by: <a href="http://www.cnd.org/HYPLAN/wlin/">WL</a></PRE>
+class ChartRipper
+ def self.rip(date)
+ agent = Mechanize.new
+ page = agent.get("http://www.cnd.org/cgi/lunar/s2l/English?#{date.year}+#{date.month}+#{date.day}+#{date.hour}")
+ match = page.content.match(/([a-zA-Z]{2,10})\d\-([a-zA-Z]{2,10})\d\.([a-zA-Z]{2,10})\d\-([a-zA-Z]{2,10})\d\.([a-zA-Z]{2,10})\d\-([a-zA-Z]{2,10})\d\.([a-zA-Z]{2,10})\d\-([a-zA-Z]{2,10})\d/)
+ date_match = page.content.match(/Lunar\s+\:\s+(\d{4})\.(\d{1,2}).(\d{1,2}).(\d{1,2})/)
+
+ Chart.new solar_date: date,
+ year: Pillar.from_name("#{match[1]} #{match[2]}"),
+ month: Pillar.from_name("#{match[3]} #{match[4]}"),
+ day: Pillar.from_name("#{match[5]} #{match[6]}"),
+ hour: Pillar.from_name("#{match[7]} #{match[8]}"),
+ lunar_year: (date_match[1].to_i + 2698),
+ lunar_month: date_match[2],
+ day_of_month: date_match[3]
+
+ end
+end
View
99 app/models/hexagram.rb
@@ -0,0 +1,99 @@
+# encoding: utf-8
+
+class Hexagram
+ @hexagram_of_the_day = 'Nicebar ䷀'
+ @hexagram_of_the_day = 'Nicebar &#x4DC0;'
+
+ def self.for_the_day(datetime)
+ this_year = LunarYear.where("start_date <= ?", datetime).order('start_date desc').first
+ date = DateTime.parse(this_year.start_date.to_s)
+ days = datetime - date
+ hexagram = DAILY_SEQUENCE[(this_year.hexagram_cycle_starting_point + days)%72]
+ hexagram
+ end
+
+ def self.[](i)
+ HEXAGRAMS[i]
+ end
+
+ DAILY_SEQUENCE = [
+ 1, 43, 14, 34, 0, 9, 5, 26, 11,
+ 10, 58, 38, 54, 0, 61, 60, 41, 19,
+ 13, 49, 30, 55, 0, 37, 63, 22, 36,
+ 25, 17, 21, 51, 0, 42, 3, 27, 24,
+ 44, 28, 50, 32, 0, 57, 48, 18, 46,
+ 6, 47, 64, 40, 0, 59, 29, 4, 7,
+ 33, 31, 56, 62, 0, 53, 39, 52, 15,
+ 12, 45, 35, 16, 0, 20, 8, 23, 2
+ ]
+
+ HEXAGRAMS = [
+ {},
+ {hexagram: '',character: '',pinyin: 'qián',title: 'Heaven',unicode: '&#x4DC0'},
+ {hexagram: '',character: '',pinyin: 'kūn',title: 'Earth',unicode: '&#x4DC1'},
+ {hexagram: '',character: '',pinyin: 'zhūn',title: 'Sprouting',unicode: '&#x4DC2'},
+ {hexagram: '',character: '',pinyin: 'méng',title: 'Immaturity',unicode: '&#x4DC3'},
+ {hexagram: '',character: '',pinyin: '',title: 'Waiting',unicode: '&#x4DC4'},
+ {hexagram: '',character: '',pinyin: 'sòng',title: 'Disputing',unicode: '&#x4DC5'},
+ {hexagram: '',character: '',pinyin: 'shī',title: 'Army',unicode: '&#x4DC6'},
+ {hexagram: '',character: '',pinyin: '',title: 'Alliance',unicode: '&#x4DC7'},
+ {hexagram: '',character: '小畜',pinyin: 'xiǎo chù',title: 'Minor Force',unicode: '&#x4DC8'},
+ {hexagram: '',character: '',pinyin: '',title: 'Treading',unicode: '&#x4DC9'},
+ {hexagram: '',character: '',pinyin: 'tài',title: 'Great',unicode: '&#x4DCA'},
+ {hexagram: '',character: '',pinyin: '',title: 'Obstruction',unicode: '&#x4DCB'},
+ {hexagram: '',character: '同人',pinyin: 'tóng rén',title: 'Community',unicode: '&#x4DCC'},
+ {hexagram: '',character: '大有',pinyin: 'dà yǒu',title: 'Prosperity',unicode: '&#x4DCD'},
+ {hexagram: '',character: '',pinyin: 'qiān',title: 'Modesty',unicode: '&#x4DCE'},
+ {hexagram: '',character: '',pinyin: '',title: 'Comfort',unicode: '&#x4DCF'},
+ {hexagram: '',character: '',pinyin: 'suí',title: 'Pursuit',unicode: '&#x4DD0'},
+ {hexagram: '',character: '',pinyin: '',title: 'Contamination',unicode: '&#x4DD1'},
+ {hexagram: '',character: '',pinyin: 'lín',title: 'Approach',unicode: '&#x4DD2'},
+ {hexagram: '',character: '',pinyin: 'guān',title: 'Observance',unicode: '&#x4DD3'},
+ {hexagram: '',character: '噬嗑',pinyin: 'shì kè',title: 'Biting',unicode: '&#x4DD4'},
+ {hexagram: '',character: '',pinyin: '',title: 'Ornament',unicode: '&#x4DD5'},
+ {hexagram: '',character: '',pinyin: '',title: 'Erosion',unicode: '&#x4DD6'},
+ {hexagram: '',character: '',pinyin: '',title: 'Return',unicode: '&#x4DD7'},
+ {hexagram: '',character: '無妄',pinyin: 'wú wàng',title: 'No Expectations',unicode: '&#x4DD8'},
+ {hexagram: '',character: '大畜',pinyin: 'dà chù',title: 'Great Store',unicode: '&#x4DD9'},
+ {hexagram: '',character: '',pinyin: '',title: 'Jaws',unicode: '&#x4DDA'},
+ {hexagram: '',character: '大過',pinyin: 'dà guò',title: 'Excess',unicode: '&#x4DDB'},
+ {hexagram: '',character: '',pinyin: 'kǎn',title: 'Pit',unicode: '&#x4DDC'},
+ {hexagram: '',character: '',pinyin: '',title: 'Oriole',unicode: '&#x4DDD'},
+ {hexagram: '',character: '',pinyin: 'xián',title: 'To Be Moved',unicode: '&#x4DDE'},
+ {hexagram: '',character: '',pinyin: 'héng',title: 'Constancy',unicode: '&#x4DDF'},
+ {hexagram: '',character: '',pinyin: 'dùn',title: 'Pig',unicode: '&#x4DE0'},
+ {hexagram: '',character: '大壯',pinyin: 'dà zhuàng',title: 'Great Strength',unicode: '&#x4DE1'},
+ {hexagram: '',character: '',pinyin: 'jìn',title: 'Advance',unicode: '&#x4DE2'},
+ {hexagram: '',character: '明夷',pinyin: 'míng yí',title: 'Pheasant Call',unicode: '&#x4DE3'},
+ {hexagram: '',character: '家人',pinyin: 'jiā rén',title: 'Household',unicode: '&#x4DE4'},
+ {hexagram: '',character: '',pinyin: 'kuí',title: 'Incompatible',unicode: '&#x4DE5'},
+ {hexagram: '',character: '',pinyin: 'jiǎn',title: 'Stumbling',unicode: '&#x4DE6'},
+ {hexagram: '',character: '',pinyin: 'xiè',title: 'Release',unicode: '&#x4DE7'},
+ {hexagram: '',character: '',pinyin: 'sǔn',title: 'Diminish',unicode: '&#x4DE8'},
+ {hexagram: '',character: '',pinyin: '',title: 'Increase',unicode: '&#x4DE9'},
+ {hexagram: '',character: '',pinyin: 'guài',title: 'Lurch',unicode: '&#x4DEA'},
+ {hexagram: '',character: '',pinyin: 'gòu',title: 'Meeting',unicode: '&#x4DEB'},
+ {hexagram: '',character: '',pinyin: 'cuì',title: 'Asembly',unicode: '&#x4DEC'},
+ {hexagram: '',character: '',pinyin: 'shēng',title: 'Ascending',unicode: '&#x4DED'},
+ {hexagram: '',character: '',pinyin: 'kùn',title: 'Beset',unicode: '&#x4DEE'},
+ {hexagram: '',character: '',pinyin: 'jǐng',title: 'The Well',unicode: '&#x4DEF'},
+ {hexagram: '',character: '',pinyin: '',title: 'Molting',unicode: '&#x4DF0'},
+ {hexagram: '',character: '',pinyin: 'dǐng',title: 'Tripod Vessel',unicode: '&#x4DF1'},
+ {hexagram: '',character: '',pinyin: 'zhèn',title: 'Thunder',unicode: '&#x4DF2'},
+ {hexagram: '',character: '',pinyin: 'gèn',title: 'Still',unicode: '&#x4DF3'},
+ {hexagram: '',character: '',pinyin: 'jiàn',title: 'Gliding',unicode: '&#x4DF4'},
+ {hexagram: '',character: '歸妹',pinyin: 'guī mèi',title: 'A Girl is Married',unicode: '&#x4DF5'},
+ {hexagram: '',character: '',pinyin: 'fēng',title: 'Abundance',unicode: '&#x4DF6'},
+ {hexagram: '',character: '',pinyin: '',title: 'Sojourner',unicode: '&#x4DF7'},
+ {hexagram: '',character: '',pinyin: 'xùn',title: 'Compliance',unicode: '&#x4DF8'},
+ {hexagram: '',character: '',pinyin: 'duì',title: 'Pleasuring',unicode: '&#x4DF9'},
+ {hexagram: '',character: '',pinyin: 'huàn',title: 'Overflowing',unicode: '&#x4DFA'},
+ {hexagram: '',character: '',pinyin: 'jié',title: 'Juncture',unicode: '&#x4DFB'},
+ {hexagram: '',character: '中孚',pinyin: 'zhōng fú',title: 'Holding the Center',unicode: '&#x4DFC'},
+ {hexagram: '',character: '小過',pinyin: 'xiǎo guò',title: 'Small Succeeds',unicode: '&#x4DFD'},
+ {hexagram: '',character: '既濟',pinyin: 'jì jì',title: 'Already Across',unicode: '&#x4DFE'},
+ {hexagram: '䷿',character: '未濟',pinyin: 'wèi jì',title: 'Not Yet Across',unicode: '&#x4DFF'}
+ ]
+
+end
+
View
42 app/models/lunar_year.rb
@@ -0,0 +1,42 @@
+class LunarYear < ActiveRecord::Base
+
+ def self.find_by_solar_year(year)
+ where(year_number: (2698+year)).first
+ end
+
+ def self.seed
+ LunarYear.destroy_all
+
+ date = DateTime.parse("1900-01-31")
+ chart = ChartRipper.rip(date)
+ LunarYear.create! year_number: (2698+date.year), yin_yang: chart.year.branch.native_stem.yin_yang, start_date: chart.solar_date
+
+ (1901..2039).each do |year|
+ date = DateTime.parse("#{year}-01-01")
+ chart = ChartRipper.rip(date)
+ while chart.lunar_month != 1 || chart.day_of_month != 1 do
+ date += 1.day
+ puts "Checking #{date}"
+ chart = ChartRipper.rip(date)
+ end
+ puts "Beginning of the year #{chart.solar_date.year} is on #{chart.solar_date.month}/#{chart.solar_date.day}"
+ LunarYear.create! year_number: (2698+year), yin_yang: chart.year.branch.native_stem.yin_yang, start_date: chart.solar_date
+
+ end
+
+ LunarYear.find_by_solar_year(1900).update_attributes hexagram_cycle_starting_point: 12
+
+ (1901..2039).each do |year_num|
+ year = LunarYear.find_by_solar_year(year_num)
+ prior_year = LunarYear.find_by_solar_year(year_num-1)
+ days = ((year.start_date-prior_year.start_date)/(24*3600) - 1).to_i
+
+ location_in_sequence = prior_year.hexagram_cycle_starting_point +
+ days * (prior_year.yin_yang=='yang' ? 1 : -1) +
+ (year.yin_yang=='yang' ? 1 : -1)
+ location_in_sequence = location_in_sequence % 72
+
+ year.update_attributes hexagram_cycle_starting_point: location_in_sequence
+ end
+ end
+end
View
11 app/views/comments/_comment.html.haml
@@ -1,4 +1,9 @@
.comment
- = comment.comments
- .edit_comment= link_to 'edit', edit_polymorphic_url([parent, comment])
- .delete_comment= link_to 'delete', polymorphic_url([parent, comment]), method: 'delete'
+ .commentary= comment.comments
+ .edit_comment
+ = link_to edit_polymorphic_url([parent, comment]), title: 'edit comment' do
+ = image_tag 'icons/edit-icon.png', width: '20px', height: '20px'
+ .delete_comment
+ = link_to polymorphic_url([parent, comment]), method: 'delete', title: 'remove comment', confirm: 'really delete this comment?' do
+ = image_tag 'icons/delete-icon.png', width: '20px', height: '20px'
+
View
2 app/views/comments/_comments_list.html.haml
@@ -4,6 +4,6 @@
= render partial: 'comments/comment', collection: @comments
%h3 Add a comment:
-= form_for [resource, @new_comment], remote: true, html: {id: 'new_comment_form'} do |f|
+= form_for [parent, comments.build], remote: true, html: {id: 'new_comment_form'} do |f|
= f.text_area :comments
= f.submit "New Comment", disable_with: 'Saving'
View
1 app/views/comments/index.js.erb
@@ -0,0 +1 @@
+$('#<%= parent_class.name.underscore %>_<%= parent.id %>').html('<%= escape_javascript(render partial: 'comments_list') %>');
View
2 app/views/layouts/application.html.haml
@@ -21,7 +21,7 @@
%ul.nav_list
%li= link_to 'charts', people_path
%li= link_to 'stars', stars_path
- %li= link_to 'pillars', pillars_path
+ %li= link_to 'stems + branches', pillars_path
= yield(:navigation)
#content_wrapper
#content
View
1 app/views/people/_number.html.haml
@@ -0,0 +1 @@
+!=
View
2 app/views/people/index.html.haml
@@ -1,5 +1,5 @@
%div{align: :center}
- %h1 Natal Astrology
+ %h1 My Charts
%h2= link_to '- Add a Person -', new_person_path
%br/
View
18 app/views/pillars/index.html.haml
@@ -1,3 +1,15 @@
-%ul.list_stuff
- - Pillar.all.each do |pillar|
- %li= link_to pillar.name, pillar
+.stems_and_branches
+ %h1 Stems and Branches
+
+ %h2 By Animal:
+
+ - Branch.all.each do |branch|
+ .branch
+ %h3= branch.animal.titleize
+ %ul.list_stuff
+ - Pillar.all.select{|t| t.branch.animal == branch.animal}.each do |pillar|
+ %li= link_to pillar.name, pillar
+
+ -# %ul.list_stuff
+ -# - Pillar.all.each do |pillar|
+ -# %li= link_to pillar.name, pillar
View
24 app/views/pillars/show.html.haml
@@ -1,3 +1,25 @@
%h1 #{resource.name}
-= render partial: 'comments/comments_list'
+%h4 My Charts With #{resource.name} Year:
+- if @by_year.empty?
+ .notice
+ You have not yet entered any charts from #{resource.name} years
+ = link_to 'Add one!', new_person_path
+- else
+ %ul.list_stuff
+ - @by_year.each do |person|
+ %li= link_to person.full_name, person
+
+
+%h4 My Charts With #{resource.name} Hour:
+- if @by_hour.empty?
+ .notice
+ You have not yet entered any charts from #{resource.name} hours
+ = link_to 'Add one!', new_person_path
+- else
+ %ul.list_stuff
+ - @by_hour.each do |person|
+ %li= link_to person.full_name, person
+%hr
+%h3 Commentary on this Stem and Branch:
+.comments_list[resource]{'data-load-from' => polymorphic_url([resource, :comments], format: :js)}
View
7 app/views/stars/index.html.haml
@@ -1,3 +1,8 @@
+%h1 The Stars of Polestar Astrology
%ul.list_stuff
- Star.all.each do |star|
- %li= link_to star.pinyin, star
+ %li
+ = link_to star do
+ = star.pinyin
+ = '/'
+ = star.english
View
4 app/views/stars/show.html.haml
@@ -1,3 +1,5 @@
%h1 #{@star.pinyin} / #{@star.english}
-= render partial: 'comments/comments_list'
+%hr
+%h3 Commentary on this star:
+.comments_list[resource]{'data-load-from' => polymorphic_url([resource, :comments], format: :js)}
View
2 config/routes.rb
@@ -7,7 +7,7 @@
resources :comments
end
- resources :pillars, :only => [:index, :show] do
+ resources :stems_and_branches, controller: 'pillars', as: 'pillars', :only => [:index, :show] do
resources :comments
end
View
13 db/migrate/20120317213019_create_lunar_years.rb
@@ -0,0 +1,13 @@
+class CreateLunarYears < ActiveRecord::Migration
+ def change
+ create_table :lunar_years do |t|
+ t.integer :year_number
+ t.datetime :start_date
+ t.string :yin_yang
+ t.integer :hexagram_cycle_starting_point
+ t.integer :days_in_year
+
+ t.timestamps
+ end
+ end
+end
View
12 db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120317032712) do
+ActiveRecord::Schema.define(:version => 20120317213019) do
create_table "branches", :force => true do |t|
t.string "char"
@@ -96,6 +96,16 @@
add_index "comments", ["commentable_id", "commentable_type", "member_id"], :name => "comments_finder_index"
+ create_table "lunar_years", :force => true do |t|
+ t.integer "year_number"
+ t.datetime "start_date"
+ t.string "yin_yang"
+ t.integer "hexagram_cycle_starting_point"
+ t.integer "days_in_year"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "members", :force => true do |t|
t.string "email", :default => "", :null => false
t.string "encrypted_password", :default => "", :null => false
View
28 spec/models/hexagram_spec.rb
@@ -0,0 +1,28 @@
+require 'spec_helper'
+
+describe Hexagram do
+ describe "for_the_day" do
+ subject {Hexagram}
+ it "should be 45 for Jan 31 1900" do
+ Hexagram.for_the_day(DateTime.parse('1900-01-31')).should be == 45
+ end
+
+ it "should be 2 for Feb 7 1900" do
+ Hexagram.for_the_day(DateTime.parse('1900-02-07')).should be == 2
+ end
+
+ it {should select_hexagram(5).for_date('1900-02-14')}
+ it {should select_hexagram(27).for_date('1900-03-14')}
+ it {should select_hexagram(57).for_date('1900-03-21')}
+ it {should select_hexagram(40).for_date('1900-03-28')}
+ it {should select_hexagram(23).for_date('1900-04-19')}
+ it {should select_hexagram(2).for_date('1900-04-21')}
+ it {should select_hexagram(8).for_date('1900-04-23')}
+
+ # it {should select_hexagram(16).for_date('1900-04-26')}
+ #
+ # it {should select_hexagram(53).for_date('1900-05-03')}
+ # it {should select_hexagram(50).for_date('1900-05-24')}
+
+ end
+end
View
3 spec/spec_helper.rb
@@ -30,6 +30,9 @@
# Pillar.reseed
# Star.reseed
# Palace.reseed
+ if LunarYear.count == 0
+ reseed_lunar_years
+ end
DatabaseCleaner.strategy = :transaction
# DatabaseCleaner.clean_with(:truncation)
end
View
145 spec/support/reseed_lunar_years.rb
@@ -0,0 +1,145 @@
+def reseed_lunar_years
+ LunarYear.destroy_all
+
+ LunarYear.create! start_date: DateTime.parse('1902-02-08 00:00:00 UTC'), year_number: 4600, yin_yang: 'yang', hexagram_cycle_starting_point: 22
+ LunarYear.create! start_date: DateTime.parse('1901-02-19 00:00:00 UTC'), year_number: 4599, yin_yang: 'yin', hexagram_cycle_starting_point: 14
+ LunarYear.create! start_date: DateTime.parse('1903-01-29 00:00:00 UTC'), year_number: 4601, yin_yang: 'yin', hexagram_cycle_starting_point: 15
+ LunarYear.create! start_date: DateTime.parse('1904-02-16 00:00:00 UTC'), year_number: 4602, yin_yang: 'yang', hexagram_cycle_starting_point: 66
+ LunarYear.create! start_date: DateTime.parse('1905-02-04 00:00:00 UTC'), year_number: 4603, yin_yang: 'yin', hexagram_cycle_starting_point: 58
+ LunarYear.create! start_date: DateTime.parse('1906-01-25 00:00:00 UTC'), year_number: 4604, yin_yang: 'yang', hexagram_cycle_starting_point: 65
+ LunarYear.create! start_date: DateTime.parse('1907-02-13 00:00:00 UTC'), year_number: 4605, yin_yang: 'yin', hexagram_cycle_starting_point: 15
+ LunarYear.create! start_date: DateTime.parse('1909-01-22 00:00:00 UTC'), year_number: 4607, yin_yang: 'yin', hexagram_cycle_starting_point: 16
+ LunarYear.create! start_date: DateTime.parse('1910-02-10 00:00:00 UTC'), year_number: 4608, yin_yang: 'yang', hexagram_cycle_starting_point: 66
+ LunarYear.create! start_date: DateTime.parse('1911-01-30 00:00:00 UTC'), year_number: 4609, yin_yang: 'yin', hexagram_cycle_starting_point: 58
+ LunarYear.create! start_date: DateTime.parse('1912-02-18 00:00:00 UTC'), year_number: 4610, yin_yang: 'yang', hexagram_cycle_starting_point: 36
+ LunarYear.create! start_date: DateTime.parse('1913-02-06 00:00:00 UTC'), year_number: 4611, yin_yang: 'yin', hexagram_cycle_starting_point: 28
+ LunarYear.create! start_date: DateTime.parse('1914-01-26 00:00:00 UTC'), year_number: 4612, yin_yang: 'yang', hexagram_cycle_starting_point: 36
+ LunarYear.create! start_date: DateTime.parse('1915-02-14 00:00:00 UTC'), year_number: 4613, yin_yang: 'yin', hexagram_cycle_starting_point: 58
+ LunarYear.create! start_date: DateTime.parse('1916-02-03 00:00:00 UTC'), year_number: 4614, yin_yang: 'yang', hexagram_cycle_starting_point: 66
+ LunarYear.create! start_date: DateTime.parse('1917-01-23 00:00:00 UTC'), year_number: 4615, yin_yang: 'yin', hexagram_cycle_starting_point: 59
+ LunarYear.create! start_date: DateTime.parse('1919-02-01 00:00:00 UTC'), year_number: 4617, yin_yang: 'yin', hexagram_cycle_starting_point: 30
+ LunarYear.create! start_date: DateTime.parse('1920-02-20 00:00:00 UTC'), year_number: 4618, yin_yang: 'yang', hexagram_cycle_starting_point: 8
+ LunarYear.create! start_date: DateTime.parse('1921-02-08 00:00:00 UTC'), year_number: 4619, yin_yang: 'yin', hexagram_cycle_starting_point: 0
+ LunarYear.create! start_date: DateTime.parse('1922-01-28 00:00:00 UTC'), year_number: 4620, yin_yang: 'yang', hexagram_cycle_starting_point: 8
+ LunarYear.create! start_date: DateTime.parse('1923-02-16 00:00:00 UTC'), year_number: 4621, yin_yang: 'yin', hexagram_cycle_starting_point: 30
+ LunarYear.create! start_date: DateTime.parse('1924-02-05 00:00:00 UTC'), year_number: 4622, yin_yang: 'yang', hexagram_cycle_starting_point: 38
+ LunarYear.create! start_date: DateTime.parse('1925-01-24 00:00:00 UTC'), year_number: 4623, yin_yang: 'yin', hexagram_cycle_starting_point: 30
+ LunarYear.create! start_date: DateTime.parse('1926-02-13 00:00:00 UTC'), year_number: 4624, yin_yang: 'yang', hexagram_cycle_starting_point: 7
+ LunarYear.create! start_date: DateTime.parse('1927-02-02 00:00:00 UTC'), year_number: 4625, yin_yang: 'yin', hexagram_cycle_starting_point: 71
+ LunarYear.create! start_date: DateTime.parse('1929-02-10 00:00:00 UTC'), year_number: 4627, yin_yang: 'yin', hexagram_cycle_starting_point: 28
+ LunarYear.create! start_date: DateTime.parse('1930-01-30 00:00:00 UTC'), year_number: 4628, yin_yang: 'yang', hexagram_cycle_starting_point: 36
+ LunarYear.create! start_date: DateTime.parse('1931-02-17 00:00:00 UTC'), year_number: 4629, yin_yang: 'yin', hexagram_cycle_starting_point: 57
+ LunarYear.create! start_date: DateTime.parse('1932-02-06 00:00:00 UTC'), year_number: 4630, yin_yang: 'yang', hexagram_cycle_starting_point: 65
+ LunarYear.create! start_date: DateTime.parse('1933-01-26 00:00:00 UTC'), year_number: 4631, yin_yang: 'yin', hexagram_cycle_starting_point: 58
+ LunarYear.create! start_date: DateTime.parse('1934-02-14 00:00:00 UTC'), year_number: 4632, yin_yang: 'yang', hexagram_cycle_starting_point: 36
+ LunarYear.create! start_date: DateTime.parse('1935-02-04 00:00:00 UTC'), year_number: 4633, yin_yang: 'yin', hexagram_cycle_starting_point: 29
+ LunarYear.create! start_date: DateTime.parse('1936-01-24 00:00:00 UTC'), year_number: 4634, yin_yang: 'yang', hexagram_cycle_starting_point: 37
+ LunarYear.create! start_date: DateTime.parse('1938-01-31 00:00:00 UTC'), year_number: 4636, yin_yang: 'yang', hexagram_cycle_starting_point: 67
+ LunarYear.create! start_date: DateTime.parse('1939-02-19 00:00:00 UTC'), year_number: 4637, yin_yang: 'yin', hexagram_cycle_starting_point: 17
+ LunarYear.create! start_date: DateTime.parse('1940-02-08 00:00:00 UTC'), year_number: 4638, yin_yang: 'yang', hexagram_cycle_starting_point: 25
+ LunarYear.create! start_date: DateTime.parse('1941-01-27 00:00:00 UTC'), year_number: 4639, yin_yang: 'yin', hexagram_cycle_starting_point: 17
+ LunarYear.create! start_date: DateTime.parse('1942-02-15 00:00:00 UTC'), year_number: 4640, yin_yang: 'yang', hexagram_cycle_starting_point: 67
+ LunarYear.create! start_date: DateTime.parse('1943-02-05 00:00:00 UTC'), year_number: 4641, yin_yang: 'yin', hexagram_cycle_starting_point: 60
+ LunarYear.create! start_date: DateTime.parse('1944-01-25 00:00:00 UTC'), year_number: 4642, yin_yang: 'yang', hexagram_cycle_starting_point: 68
+ LunarYear.create! start_date: DateTime.parse('1945-02-13 00:00:00 UTC'), year_number: 4643, yin_yang: 'yin', hexagram_cycle_starting_point: 19
+ LunarYear.create! start_date: DateTime.parse('1947-01-22 00:00:00 UTC'), year_number: 4645, yin_yang: 'yin', hexagram_cycle_starting_point: 19
+ LunarYear.create! start_date: DateTime.parse('1948-02-10 00:00:00 UTC'), year_number: 4646, yin_yang: 'yang', hexagram_cycle_starting_point: 69
+ LunarYear.create! start_date: DateTime.parse('1949-01-29 00:00:00 UTC'), year_number: 4647, yin_yang: 'yin', hexagram_cycle_starting_point: 61
+ LunarYear.create! start_date: DateTime.parse('1950-02-17 00:00:00 UTC'), year_number: 4648, yin_yang: 'yang', hexagram_cycle_starting_point: 39
+ LunarYear.create! start_date: DateTime.parse('1951-02-06 00:00:00 UTC'), year_number: 4649, yin_yang: 'yin', hexagram_cycle_starting_point: 31
+ LunarYear.create! start_date: DateTime.parse('1952-01-27 00:00:00 UTC'), year_number: 4650, yin_yang: 'yang', hexagram_cycle_starting_point: 38
+ LunarYear.create! start_date: DateTime.parse('1953-02-14 00:00:00 UTC'), year_number: 4651, yin_yang: 'yin', hexagram_cycle_starting_point: 60
+ LunarYear.create! start_date: DateTime.parse('1954-02-03 00:00:00 UTC'), year_number: 4652, yin_yang: 'yang', hexagram_cycle_starting_point: 68
+ LunarYear.create! start_date: DateTime.parse('1956-02-12 00:00:00 UTC'), year_number: 4654, yin_yang: 'yang', hexagram_cycle_starting_point: 39
+ LunarYear.create! start_date: DateTime.parse('1957-01-31 00:00:00 UTC'), year_number: 4655, yin_yang: 'yin', hexagram_cycle_starting_point: 31
+ LunarYear.create! start_date: DateTime.parse('1958-02-18 00:00:00 UTC'), year_number: 4656, yin_yang: 'yang', hexagram_cycle_starting_point: 10
+ LunarYear.create! start_date: DateTime.parse('1959-02-08 00:00:00 UTC'), year_number: 4657, yin_yang: 'yin', hexagram_cycle_starting_point: 3
+ LunarYear.create! start_date: DateTime.parse('1960-01-28 00:00:00 UTC'), year_number: 4658, yin_yang: 'yang', hexagram_cycle_starting_point: 11
+ LunarYear.create! start_date: DateTime.parse('1961-02-15 00:00:00 UTC'), year_number: 4659, yin_yang: 'yin', hexagram_cycle_starting_point: 33
+ LunarYear.create! start_date: DateTime.parse('1962-02-05 00:00:00 UTC'), year_number: 4660, yin_yang: 'yang', hexagram_cycle_starting_point: 40
+ LunarYear.create! start_date: DateTime.parse('1963-01-25 00:00:00 UTC'), year_number: 4661, yin_yang: 'yin', hexagram_cycle_starting_point: 32
+ LunarYear.create! start_date: DateTime.parse('1965-02-02 00:00:00 UTC'), year_number: 4663, yin_yang: 'yin', hexagram_cycle_starting_point: 3
+ LunarYear.create! start_date: DateTime.parse('1966-01-21 00:00:00 UTC'), year_number: 4664, yin_yang: 'yang', hexagram_cycle_starting_point: 12
+ LunarYear.create! start_date: DateTime.parse('1967-02-09 00:00:00 UTC'), year_number: 4665, yin_yang: 'yin', hexagram_cycle_starting_point: 34
+ LunarYear.create! start_date: DateTime.parse('1968-01-30 00:00:00 UTC'), year_number: 4666, yin_yang: 'yang', hexagram_cycle_starting_point: 41
+ LunarYear.create! start_date: DateTime.parse('1969-02-17 00:00:00 UTC'), year_number: 4667, yin_yang: 'yin', hexagram_cycle_starting_point: 63
+ LunarYear.create! start_date: DateTime.parse('1970-02-06 00:00:00 UTC'), year_number: 4668, yin_yang: 'yang', hexagram_cycle_starting_point: 71
+ LunarYear.create! start_date: DateTime.parse('1971-01-27 00:00:00 UTC'), year_number: 4669, yin_yang: 'yin', hexagram_cycle_starting_point: 64
+ LunarYear.create! start_date: DateTime.parse('1972-02-15 00:00:00 UTC'), year_number: 4670, yin_yang: 'yang', hexagram_cycle_starting_point: 42
+ LunarYear.create! start_date: DateTime.parse('1974-01-23 00:00:00 UTC'), year_number: 4672, yin_yang: 'yang', hexagram_cycle_starting_point: 42
+ LunarYear.create! start_date: DateTime.parse('1975-02-11 00:00:00 UTC'), year_number: 4673, yin_yang: 'yin', hexagram_cycle_starting_point: 64
+ LunarYear.create! start_date: DateTime.parse('1976-01-31 00:00:00 UTC'), year_number: 4674, yin_yang: 'yang', hexagram_cycle_starting_point: 0
+ LunarYear.create! start_date: DateTime.parse('1977-02-18 00:00:00 UTC'), year_number: 4675, yin_yang: 'yin', hexagram_cycle_starting_point: 22
+ LunarYear.create! start_date: DateTime.parse('1978-02-07 00:00:00 UTC'), year_number: 4676, yin_yang: 'yang', hexagram_cycle_starting_point: 30
+ LunarYear.create! start_date: DateTime.parse('1979-01-28 00:00:00 UTC'), year_number: 4677, yin_yang: 'yin', hexagram_cycle_starting_point: 23
+ LunarYear.create! start_date: DateTime.parse('1980-02-16 00:00:00 UTC'), year_number: 4678, yin_yang: 'yang', hexagram_cycle_starting_point: 1
+ LunarYear.create! start_date: DateTime.parse('1981-02-05 00:00:00 UTC'), year_number: 4679, yin_yang: 'yin', hexagram_cycle_starting_point: 66
+ LunarYear.create! start_date: DateTime.parse('1983-02-13 00:00:00 UTC'), year_number: 4681, yin_yang: 'yin', hexagram_cycle_starting_point: 24
+ LunarYear.create! start_date: DateTime.parse('1984-02-02 00:00:00 UTC'), year_number: 4682, yin_yang: 'yang', hexagram_cycle_starting_point: 32
+ LunarYear.create! start_date: DateTime.parse('1985-02-20 00:00:00 UTC'), year_number: 4683, yin_yang: 'yin', hexagram_cycle_starting_point: 54
+ LunarYear.create! start_date: DateTime.parse('1986-02-09 00:00:00 UTC'), year_number: 4684, yin_yang: 'yang', hexagram_cycle_starting_point: 62
+ LunarYear.create! start_date: DateTime.parse('1987-01-29 00:00:00 UTC'), year_number: 4685, yin_yang: 'yin', hexagram_cycle_starting_point: 54
+ LunarYear.create! start_date: DateTime.parse('1988-02-17 00:00:00 UTC'), year_number: 4686, yin_yang: 'yang', hexagram_cycle_starting_point: 32
+ LunarYear.create! start_date: DateTime.parse('1989-02-06 00:00:00 UTC'), year_number: 4687, yin_yang: 'yin', hexagram_cycle_starting_point: 25
+ LunarYear.create! start_date: DateTime.parse('1990-01-27 00:00:00 UTC'), year_number: 4688, yin_yang: 'yang', hexagram_cycle_starting_point: 32
+ LunarYear.create! start_date: DateTime.parse('1992-02-04 00:00:00 UTC'), year_number: 4690, yin_yang: 'yang', hexagram_cycle_starting_point: 62
+ LunarYear.create! start_date: DateTime.parse('1993-01-23 00:00:00 UTC'), year_number: 4691, yin_yang: 'yin', hexagram_cycle_starting_point: 54
+ LunarYear.create! start_date: DateTime.parse('1994-02-10 00:00:00 UTC'), year_number: 4692, yin_yang: 'yang', hexagram_cycle_starting_point: 33
+ LunarYear.create! start_date: DateTime.parse('1995-01-31 00:00:00 UTC'), year_number: 4693, yin_yang: 'yin', hexagram_cycle_starting_point: 26
+ LunarYear.create! start_date: DateTime.parse('1996-02-19 00:00:00 UTC'), year_number: 4694, yin_yang: 'yang', hexagram_cycle_starting_point: 4
+ LunarYear.create! start_date: DateTime.parse('1997-02-07 00:00:00 UTC'), year_number: 4695, yin_yang: 'yin', hexagram_cycle_starting_point: 68
+ LunarYear.create! start_date: DateTime.parse('1998-01-28 00:00:00 UTC'), year_number: 4696, yin_yang: 'yang', hexagram_cycle_starting_point: 3
+ LunarYear.create! start_date: DateTime.parse('1999-02-16 00:00:00 UTC'), year_number: 4697, yin_yang: 'yin', hexagram_cycle_starting_point: 25
+ LunarYear.create! start_date: DateTime.parse('2001-01-24 00:00:00 UTC'), year_number: 4699, yin_yang: 'yin', hexagram_cycle_starting_point: 25
+ LunarYear.create! start_date: DateTime.parse('2002-02-12 00:00:00 UTC'), year_number: 4700, yin_yang: 'yang', hexagram_cycle_starting_point: 3
+ LunarYear.create! start_date: DateTime.parse('2003-02-01 00:00:00 UTC'), year_number: 4701, yin_yang: 'yin', hexagram_cycle_starting_point: 67
+ LunarYear.create! start_date: DateTime.parse('2004-01-22 00:00:00 UTC'), year_number: 4702, yin_yang: 'yang', hexagram_cycle_starting_point: 2
+ LunarYear.create! start_date: DateTime.parse('2005-02-09 00:00:00 UTC'), year_number: 4703, yin_yang: 'yin', hexagram_cycle_starting_point: 24
+ LunarYear.create! start_date: DateTime.parse('2006-01-29 00:00:00 UTC'), year_number: 4704, yin_yang: 'yang', hexagram_cycle_starting_point: 32
+ LunarYear.create! start_date: DateTime.parse('2007-02-18 00:00:00 UTC'), year_number: 4705, yin_yang: 'yin', hexagram_cycle_starting_point: 55
+ LunarYear.create! start_date: DateTime.parse('2008-02-07 00:00:00 UTC'), year_number: 4706, yin_yang: 'yang', hexagram_cycle_starting_point: 63
+ LunarYear.create! start_date: DateTime.parse('2010-02-14 00:00:00 UTC'), year_number: 4708, yin_yang: 'yang', hexagram_cycle_starting_point: 33
+ LunarYear.create! start_date: DateTime.parse('2011-02-03 00:00:00 UTC'), year_number: 4709, yin_yang: 'yin', hexagram_cycle_starting_point: 25
+ LunarYear.create! start_date: DateTime.parse('2012-01-23 00:00:00 UTC'), year_number: 4710, yin_yang: 'yang', hexagram_cycle_starting_point: 33
+ LunarYear.create! start_date: DateTime.parse('2013-02-10 00:00:00 UTC'), year_number: 4711, yin_yang: 'yin', hexagram_cycle_starting_point: 55
+ LunarYear.create! start_date: DateTime.parse('2014-01-31 00:00:00 UTC'), year_number: 4712, yin_yang: 'yang', hexagram_cycle_starting_point: 62
+ LunarYear.create! start_date: DateTime.parse('2015-02-19 00:00:00 UTC'), year_number: 4713, yin_yang: 'yin', hexagram_cycle_starting_point: 12
+ LunarYear.create! start_date: DateTime.parse('2016-02-08 00:00:00 UTC'), year_number: 4714, yin_yang: 'yang', hexagram_cycle_starting_point: 20
+ LunarYear.create! start_date: DateTime.parse('2017-01-28 00:00:00 UTC'), year_number: 4715, yin_yang: 'yin', hexagram_cycle_starting_point: 13
+ LunarYear.create! start_date: DateTime.parse('1900-01-31 00:00:00 UTC'), year_number: 4598, yin_yang: 'yang', hexagram_cycle_starting_point: 64
+ LunarYear.create! start_date: DateTime.parse('1908-02-02 00:00:00 UTC'), year_number: 4606, yin_yang: 'yang', hexagram_cycle_starting_point: 23
+ LunarYear.create! start_date: DateTime.parse('1918-02-11 00:00:00 UTC'), year_number: 4616, yin_yang: 'yang', hexagram_cycle_starting_point: 37
+ LunarYear.create! start_date: DateTime.parse('1928-01-23 00:00:00 UTC'), year_number: 4626, yin_yang: 'yang', hexagram_cycle_starting_point: 6
+ LunarYear.create! start_date: DateTime.parse('1937-02-11 00:00:00 UTC'), year_number: 4635, yin_yang: 'yin', hexagram_cycle_starting_point: 59
+ LunarYear.create! start_date: DateTime.parse('1946-02-02 00:00:00 UTC'), year_number: 4644, yin_yang: 'yang', hexagram_cycle_starting_point: 27
+ LunarYear.create! start_date: DateTime.parse('1955-01-24 00:00:00 UTC'), year_number: 4653, yin_yang: 'yin', hexagram_cycle_starting_point: 61
+ LunarYear.create! start_date: DateTime.parse('1964-02-13 00:00:00 UTC'), year_number: 4662, yin_yang: 'yang', hexagram_cycle_starting_point: 10
+ LunarYear.create! start_date: DateTime.parse('1973-02-03 00:00:00 UTC'), year_number: 4671, yin_yang: 'yin', hexagram_cycle_starting_point: 34
+ LunarYear.create! start_date: DateTime.parse('1982-01-25 00:00:00 UTC'), year_number: 4680, yin_yang: 'yang', hexagram_cycle_starting_point: 2
+ LunarYear.create! start_date: DateTime.parse('1991-02-15 00:00:00 UTC'), year_number: 4689, yin_yang: 'yin', hexagram_cycle_starting_point: 54
+ LunarYear.create! start_date: DateTime.parse('2000-02-05 00:00:00 UTC'), year_number: 4698, yin_yang: 'yang', hexagram_cycle_starting_point: 33
+ LunarYear.create! start_date: DateTime.parse('2009-01-26 00:00:00 UTC'), year_number: 4707, yin_yang: 'yin', hexagram_cycle_starting_point: 55
+ LunarYear.create! start_date: DateTime.parse('2018-02-16 00:00:00 UTC'), year_number: 4716, yin_yang: 'yang', hexagram_cycle_starting_point: 63
+ LunarYear.create! start_date: DateTime.parse('2019-02-05 00:00:00 UTC'), year_number: 4717, yin_yang: 'yin', hexagram_cycle_starting_point: 55
+ LunarYear.create! start_date: DateTime.parse('2020-01-25 00:00:00 UTC'), year_number: 4718, yin_yang: 'yang', hexagram_cycle_starting_point: 63
+ LunarYear.create! start_date: DateTime.parse('2021-02-12 00:00:00 UTC'), year_number: 4719, yin_yang: 'yin', hexagram_cycle_starting_point: 13
+ LunarYear.create! start_date: DateTime.parse('2022-02-01 00:00:00 UTC'), year_number: 4720, yin_yang: 'yang', hexagram_cycle_starting_point: 21
+ LunarYear.create! start_date: DateTime.parse('2023-01-22 00:00:00 UTC'), year_number: 4721, yin_yang: 'yin', hexagram_cycle_starting_point: 14
+ LunarYear.create! start_date: DateTime.parse('2024-02-10 00:00:00 UTC'), year_number: 4722, yin_yang: 'yang', hexagram_cycle_starting_point: 64
+ LunarYear.create! start_date: DateTime.parse('2025-01-29 00:00:00 UTC'), year_number: 4723, yin_yang: 'yin', hexagram_cycle_starting_point: 56
+ LunarYear.create! start_date: DateTime.parse('2026-02-17 00:00:00 UTC'), year_number: 4724, yin_yang: 'yang', hexagram_cycle_starting_point: 34
+ LunarYear.create! start_date: DateTime.parse('2027-02-06 00:00:00 UTC'), year_number: 4725, yin_yang: 'yin', hexagram_cycle_starting_point: 26
+ LunarYear.create! start_date: DateTime.parse('2028-01-26 00:00:00 UTC'), year_number: 4726, yin_yang: 'yang', hexagram_cycle_starting_point: 34
+ LunarYear.create! start_date: DateTime.parse('2029-02-13 00:00:00 UTC'), year_number: 4727, yin_yang: 'yin', hexagram_cycle_starting_point: 56
+ LunarYear.create! start_date: DateTime.parse('2030-02-03 00:00:00 UTC'), year_number: 4728, yin_yang: 'yang', hexagram_cycle_starting_point: 63
+ LunarYear.create! start_date: DateTime.parse('2031-01-23 00:00:00 UTC'), year_number: 4729, yin_yang: 'yin', hexagram_cycle_starting_point: 55
+ LunarYear.create! start_date: DateTime.parse('2032-02-11 00:00:00 UTC'), year_number: 4730, yin_yang: 'yang', hexagram_cycle_starting_point: 33
+ LunarYear.create! start_date: DateTime.parse('2033-01-31 00:00:00 UTC'), year_number: 4731, yin_yang: 'yin', hexagram_cycle_starting_point: 26
+ LunarYear.create! start_date: DateTime.parse('2034-02-19 00:00:00 UTC'), year_number: 4732, yin_yang: 'yang', hexagram_cycle_starting_point: 4
+ LunarYear.create! start_date: DateTime.parse('2035-02-08 00:00:00 UTC'), year_number: 4733, yin_yang: 'yin', hexagram_cycle_starting_point: 68
+ LunarYear.create! start_date: DateTime.parse('2036-01-28 00:00:00 UTC'), year_number: 4734, yin_yang: 'yang', hexagram_cycle_starting_point: 4
+ LunarYear.create! start_date: DateTime.parse('2037-02-15 00:00:00 UTC'), year_number: 4735, yin_yang: 'yin', hexagram_cycle_starting_point: 26
+ LunarYear.create! start_date: DateTime.parse('2038-02-04 00:00:00 UTC'), year_number: 4736, yin_yang: 'yang', hexagram_cycle_starting_point: 34
+ LunarYear.create! start_date: DateTime.parse('2039-01-24 00:00:00 UTC'), year_number: 4737, yin_yang: 'yin', hexagram_cycle_starting_point: 26
+
+end
View
21 spec/support/select_hexagram_matcher.rb
@@ -0,0 +1,21 @@
+RSpec::Matchers.define :select_hexagram do |number|
+ @number = number
+
+ chain :for_date do |date_str|
+ @for_date = DateTime.parse(date_str)
+ end
+
+ description do
+ "Choose hexagram #{@number} #{Hexagram[@number][:title]} for #{@for_date}"
+ end
+
+ match do |given|
+ @actual = given.for_the_day(@for_date)
+ @actual == @number
+ end
+
+ failure_message_for_should do |given|
+ "expected hexagram for #{@for_date} to be number #{@number} #{Hexagram[@number][:title]} but it was #{@actual} #{Hexagram[@actual][:title]}"
+ end
+end
+
View
10 test/factories/lunar_years.rb
@@ -0,0 +1,10 @@
+# Read about factories at https://github.com/thoughtbot/factory_girl
+
+FactoryGirl.define do
+ factory :lunar_year do
+ year_number 1
+ start_date "2012-03-17 14:30:19"
+ yin_yang "MyString"
+ hexagram_cycle_starting_point 1
+ end
+end
View
7 test/unit/lunar_year_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class LunarYearTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end

0 comments on commit 9c24e87

Please sign in to comment.
Something went wrong with that request. Please try again.