Module: ShlispTools::Shnth
- Defined in:
- lib/shlisp_tools/shnth.rb
Overview
Macros and constants for use with the shlerb tool.
Light_*: simple light values, 1-8 across
Situation_*: macros representing stevek’s idiom for switching through situations using the tar button, using the lights from left to right to show which situation is running:
-
<%= Situation_1 %>
emits(jump (tar 1)) (lights 1)
-
<%= Situation_2 %>
emits(jump (tar 1)) (lights 4)
-
etc.
But_*: scale indexes by bar (Uppercase=major, lowercase=minor), using stevek’s arrangement:
-
But_A = 0
-
But_B = 1
-
etc.
Constant Summary collapse
- Light_1 =
1
- Light_2 =
Light_1 * 2
- Light_3 =
Light_2 * 2
- Light_4 =
Light_3 * 2
- Light_5 =
Light_4 * 2
- Light_6 =
Light_5 * 2
- Light_7 =
Light_6 * 2
- Light_8 =
Light_7 * 2
- Situation_1 =
"(jump (tar 1)) (lights #{Light_1})"
- Situation_2 =
"(jump (tar 1)) (lights #{Light_2})"
- Situation_3 =
"(jump (tar 1)) (lights #{Light_3})"
- Situation_4 =
"(jump (tar 1)) (lights #{Light_4})"
- Situation_5 =
"(jump (tar 1)) (lights #{Light_5})"
- Situation_6 =
"(jump (tar 1)) (lights #{Light_6})"
- Situation_7 =
"(jump (tar 1)) (lights #{Light_7})"
- Situation_8 =
"(jump (tar 1)) (lights #{Light_8})"
- But_A =
0
- But_B =
1
- But_C =
2
- But_D =
3
- But_d =
4
- But_c =
5
- But_b =
6
- But_a =
7
Class Method Summary collapse
Class Method Details
.join(*stuff) ⇒ Object
66 67 68 |
# File 'lib/shlisp_tools/shnth.rb', line 66 def self.join(*stuff) stuff.join(' ').squeeze(' ') end |
.light(position) ⇒ Object
49 50 51 |
# File 'lib/shlisp_tools/shnth.rb', line 49 def self.light(position) 2**(position-1) end |
.situ(position, method = :tar) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/shlisp_tools/shnth.rb', line 53 def self.situ(position, method=:tar) case method when :tar jump = "(jump (tar 1))" when :minor_ab jump = "(jump (minorb 1 (minora -1)))" else ; end "#{jump} (lights #{light(position)})" end |