iching 0.0.3 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/bin/iching +1 -38
- data/iching.gemspec +9 -10
- data/lib/iching.rb +8 -1
- metadata +3 -20
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('iching', '0.0.
|
5
|
+
Echoe.new('iching', '0.0.6') do |p|
|
6
6
|
p.description = "Generate an Iching hexagram and access various things about it."
|
7
7
|
p.url = "https://github.com/mattmills/iching"
|
8
8
|
p.author = "Matt Mills"
|
data/bin/iching
CHANGED
@@ -1,42 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'rubygems'
|
3
3
|
require 'backports'
|
4
|
-
|
5
|
-
def initialize()
|
6
|
-
@hex = 6.times.map{ Random.new.rand(6..9) }.reverse
|
7
|
-
@list = {'111111'=> '1. Force (乾 qián); The Creative; Possessing Creative Power & Skill','000000'=> '2. Field (坤 kūn); The Receptive; Needing Knowledge & Skill; Do not force matters and go with the flow','100010'=> '3. Sprouting (屯 zhūn); Difficulty at the Beginning,; Sprouting ','010001'=> '4. Enveloping (蒙 méng); Youthful Folly; Detained,Enveloped and Inexperienced','111010'=> '5. Attending (需 xū); Waiting; Uninvolvement (Wait for now),Nourishment ','010111'=> '6. Arguing (訟 sòng); Conflict; Engagement in Conflict ','010000'=> '7. Leading (師 shī); The Army; Bringing Together,Teamwork ','000010'=> '8. Grouping (比 bǐ); Holding Together; Union ','111011'=> '9. Small Accumulating (小畜 xiǎo chù); Small Taming; Accumulating Resources','110111'=> '10. Treading (履 lǚ); Treading (Conduct); Continuing with Alertness','111000'=> '11. Pervading (泰 tài); Peace; Pervading','000111'=> '12. Obstruction (否 pǐ); Standstill; Stagnation','101111'=> '13. Concording People (同人 tóng rén); Fellowship; Fellowship,Partnership','111101'=> '14. Great Possessing (大有 dà yǒu); Great Possession; Independence,Freedom','001000'=> '15. Humbling (謙 qiān); Modesty; Being Reserved,Refraining','000100'=> '16. Providing-For (豫 yù); Enthusiasm; Inducement,New Stimulus','100110'=> '17. Following (隨 suí); Following; Following','011001'=> '18. Corrupting (蠱 gǔ); Work on the Decayed; Repairing','110000'=> '19. Nearing (臨 lín); Approach; Approaching Goal,Arriving ','000011'=> '20. Viewing (觀 guān); Contemplation; The Withholding','100101'=> '21. Gnawing Bite (噬嗑 shì kè); Biting Through; Deciding','101001'=> '22. Adorning (賁 bì); Grace; Embellishing','000001'=> '23. Stripping (剝 bō); Splitting Apart; Stripping,Flaying','100000'=> '24. Returning (復 fù); Return; Returning','100111'=> '25. Without Embroiling (無妄 wú wàng); Innocence; Without Rashness','111001'=> '26. Great Accumulating (大畜 dà chù); Great Taming; Accumulating Wisdom','100001'=> '27. Swallowing (頤 yí); Mouth Corners; Seeking Nourishment','011110'=> '28. Great Exceeding (大過 dà guò); Great Preponderance; Great Surpassing','010010'=> '29. Gorge (坎 kǎn); The Abysmal Water; Darkness,Gorge','101101'=> '30. Radiance (離 lí); The Clinging; Clinging,Attachment','001110'=> '31. Conjoining (咸 xián); Influence; Attraction','011100'=> '32. Persevering (恆 héng); Duration; Perseverance','001111'=> '33. Retiring (遯 dùn); Retreat; Withdrawing','111100'=> '34. Great Invigorating (大壯 dà zhuàng); Great Power; Great Boldness','000101'=> '35. Prospering (晉 jìn); Progress; Expansion,Promotion','101000'=> '36. Brightness Hiding (明夷 míng yí); Darkening of the Light; Brilliance Injured','101011'=> '37. Dwelling People (家人 jiā rén); The Family; Family','110101'=> '38. Polarising (睽 kuí); Opposition; Division,Divergence','001010'=> '39. Limping (蹇 jiǎn); Obstruction; Halting,Hardship','010100'=> '40. Taking-Apart (解 xiè); Deliverance; Liberation,Solution','110001'=> '41. Diminishing (損 sǔn); Decrease; Decrease','100011'=> '42. Augmenting (益 yì); Increase; Increase','111110'=> '43. Parting (夬 guài); Breakthrough; Separation','011111'=> '44. Coupling (姤 gòu); Coming to Meet; Encountering','000110'=> '45. Clustering (萃 cuì); Gathering Together; Association,Companionship','011000'=> '46. Ascending (升 shēng); Pushing Upward; Growing Upward','010110'=> '47. Confining (困 kùn); Oppression; Exhaustion','011010'=> '48. Welling (井 jǐng); The Well; Replenishing,Renewal','101110'=> '49. Skinning (革 gé); Revolution; Abolishing the Old','011101'=> '50. Holding (鼎 dǐng); The Cauldron; Establishing the New','100100'=> '51. Shake (震 zhèn); Arousing; Mobilizing','001001'=> '52. Bound (艮 gèn); The Keeping Still; Immobility','001011'=> '53. Infiltrating (漸 jiàn); Development; Auspicious Outlook,Infiltration','110100'=> '54. Converting The Maiden (歸妹 guī mèi); The Marrying Maiden; Marrying','101100'=> '55. Abounding (豐 fēng); Abundance; Goal Reached,Ambition Achieved','001101'=> '56. Sojourning (旅 lǚ); The Wanderer; Travel','011011'=> '57. Ground (巽 xùn); The Gentle; Subtle Influence','110110'=> '58. Open (兌 duì); The Joyous; Overt Influence','010011'=> '59. Dispersing (渙 huàn); Dispersion; Dispersal','110010'=> '60. Articulating (節 jié); Limitation; Discipline','110011'=> '61. Centre Confirming (中孚 zhōng fú); Inner Truth; Staying Focused,Avoid Misrepresentation','001100'=> '62. Small Exceeding (小過 xiǎo guò); Small Preponderance; Small Surpassing','101010'=> '63. Already_Fording (既濟 jì jì); After Completion; Completion','010101'=> '64. Not-Yet Fording (未濟 wèi jì); Before Completion; Incompletion'}
|
8
|
-
@hexagram1_key = { 6 => '-- --', 7 => '-----', 8 => '-- --', 9 => '-----'}
|
9
|
-
@hexagram2_key = { 6 => '-----', 7 => '-----', 8 => '-- --', 9 => '-- --'}
|
10
|
-
@binhex1_key = { 6 => '0', 7 => '1', 8 => '0', 9 => '1'}
|
11
|
-
@binhex2_key = { 6 => '1', 7 => '1', 8 => '0', 9 => '0'}
|
12
|
-
end
|
13
|
-
def display
|
14
|
-
if Random.new.rand(1..20) > 1
|
15
|
-
puts hex_symbol, hex_name, hex_symbol(1), hex_name(1)
|
16
|
-
else
|
17
|
-
puts "A suffusion of yellow."
|
18
|
-
end
|
19
|
-
end
|
20
|
-
def hex_name(hex = 0)
|
21
|
-
bin_hex = ''
|
22
|
-
if hex == 0
|
23
|
-
@hex.each {|stick| bin_hex << @binhex1_key[stick]}
|
24
|
-
end
|
25
|
-
if hex == 1
|
26
|
-
@hex.each {|stick| bin_hex << @binhex2_key[stick]}
|
27
|
-
end
|
28
|
-
bin_hex.reverse!
|
29
|
-
return @list[bin_hex]
|
30
|
-
end
|
31
|
-
def hex_symbol(hex = 0)
|
32
|
-
symbol = ''
|
33
|
-
if hex == 0
|
34
|
-
@hex.each {|stick| symbol << @hexagram1_key[stick] + "\n"}
|
35
|
-
end
|
36
|
-
if hex == 1
|
37
|
-
@hex.each {|stick| symbol << @hexagram2_key[stick] + "\n"}
|
38
|
-
end
|
39
|
-
return symbol
|
40
|
-
end
|
41
|
-
end
|
4
|
+
require 'iching'
|
42
5
|
Iching.new.display
|
data/iching.gemspec
CHANGED
@@ -1,24 +1,23 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
|
-
s.name =
|
5
|
-
s.version = "0.0.
|
4
|
+
s.name = "iching"
|
5
|
+
s.version = "0.0.6"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Matt Mills"]
|
9
|
-
s.date =
|
10
|
-
s.
|
11
|
-
s.
|
12
|
-
s.email = %q{sunrisetimes@gmail.com}
|
9
|
+
s.date = "2011-10-08"
|
10
|
+
s.description = "Generate an Iching hexagram and access various things about it."
|
11
|
+
s.email = "sunrisetimes@gmail.com"
|
13
12
|
s.executables = ["iching"]
|
14
13
|
s.extra_rdoc_files = ["bin/iching", "lib/iching.rb"]
|
15
14
|
s.files = ["Rakefile", "bin/iching", "lib/iching.rb", "readme.markdown", "Manifest", "iching.gemspec"]
|
16
|
-
s.homepage =
|
15
|
+
s.homepage = "https://github.com/mattmills/iching"
|
17
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Iching", "--main", "readme.markdown"]
|
18
17
|
s.require_paths = ["lib"]
|
19
|
-
s.rubyforge_project =
|
20
|
-
s.rubygems_version =
|
21
|
-
s.summary =
|
18
|
+
s.rubyforge_project = "iching"
|
19
|
+
s.rubygems_version = "1.8.11"
|
20
|
+
s.summary = "Generate an Iching hexagram and access various things about it."
|
22
21
|
|
23
22
|
if s.respond_to? :specification_version then
|
24
23
|
s.specification_version = 3
|
data/lib/iching.rb
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'rubygems'
|
3
|
-
|
3
|
+
|
4
|
+
#ruby version compatibility hax
|
5
|
+
if RUBY_VERSION.gsub(".","").to_i > 191
|
6
|
+
Encoding.default_internal = Encoding.find("UTF-8")
|
7
|
+
else
|
8
|
+
require 'backports'
|
9
|
+
end
|
10
|
+
|
4
11
|
class Iching
|
5
12
|
def initialize()
|
6
13
|
@hex = 6.times.map{ Random.new.rand(6..9) }.reverse
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iching
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 25
|
5
4
|
prerelease:
|
6
|
-
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 3
|
10
|
-
version: 0.0.3
|
5
|
+
version: 0.0.6
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Matt Mills
|
@@ -15,8 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable:
|
13
|
+
date: 2011-10-08 00:00:00 Z
|
20
14
|
dependencies:
|
21
15
|
- !ruby/object:Gem::Dependency
|
22
16
|
name: backports
|
@@ -26,9 +20,6 @@ dependencies:
|
|
26
20
|
requirements:
|
27
21
|
- - ">="
|
28
22
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
|
-
segments:
|
31
|
-
- 0
|
32
23
|
version: "0"
|
33
24
|
type: :runtime
|
34
25
|
version_requirements: *id001
|
@@ -48,7 +39,6 @@ files:
|
|
48
39
|
- readme.markdown
|
49
40
|
- Manifest
|
50
41
|
- iching.gemspec
|
51
|
-
has_rdoc: true
|
52
42
|
homepage: https://github.com/mattmills/iching
|
53
43
|
licenses: []
|
54
44
|
|
@@ -67,24 +57,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
67
57
|
requirements:
|
68
58
|
- - ">="
|
69
59
|
- !ruby/object:Gem::Version
|
70
|
-
hash: 3
|
71
|
-
segments:
|
72
|
-
- 0
|
73
60
|
version: "0"
|
74
61
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
62
|
none: false
|
76
63
|
requirements:
|
77
64
|
- - ">="
|
78
65
|
- !ruby/object:Gem::Version
|
79
|
-
hash: 11
|
80
|
-
segments:
|
81
|
-
- 1
|
82
|
-
- 2
|
83
66
|
version: "1.2"
|
84
67
|
requirements: []
|
85
68
|
|
86
69
|
rubyforge_project: iching
|
87
|
-
rubygems_version: 1.
|
70
|
+
rubygems_version: 1.8.11
|
88
71
|
signing_key:
|
89
72
|
specification_version: 3
|
90
73
|
summary: Generate an Iching hexagram and access various things about it.
|