Class: Hex1
Direct Known Subclasses
Instance Attribute Summary collapse
-
#hex ⇒ Object
readonly
Returns the value of attribute hex.
Instance Method Summary collapse
- #bin_hex_key ⇒ Object
- #hex_name ⇒ Object
- #hex_symbol ⇒ Object
- #hexagram_key ⇒ Object
-
#initialize(hex) ⇒ Hex1
constructor
A new instance of Hex1.
Methods included from Dictionaries
Constructor Details
#initialize(hex) ⇒ Hex1
Returns a new instance of Hex1.
23 24 25 |
# File 'lib/iching.rb', line 23 def initialize(hex) @hex = hex end |
Instance Attribute Details
#hex ⇒ Object (readonly)
Returns the value of attribute hex.
21 22 23 |
# File 'lib/iching.rb', line 21 def hex @hex end |
Instance Method Details
#bin_hex_key ⇒ Object
27 28 29 |
# File 'lib/iching.rb', line 27 def bin_hex_key { 6 => '0', 7 => '1', 8 => '0', 9 => '1'} end |
#hex_name ⇒ Object
39 40 41 42 |
# File 'lib/iching.rb', line 39 def hex_name hex_binary = hex.map{|n| bin_hex_key[n]}.join("").reverse() return list[hex_binary] end |
#hex_symbol ⇒ Object
35 36 37 |
# File 'lib/iching.rb', line 35 def hex_symbol hex.map{|n| hexagram_key[n] }.join("\n") end |
#hexagram_key ⇒ Object
31 32 33 |
# File 'lib/iching.rb', line 31 def hexagram_key { 6 => '-- --', 7 => '-----', 8 => '-- --', 9 => '-----'} end |