trigger_switch_d 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. data/COPYING.txt +674 -0
  2. data/LICENSE.txt +54 -0
  3. data/README.rdoc +106 -0
  4. data/bin/teach +44 -0
  5. data/bin/tsd +68 -0
  6. data/bin/turn_off +42 -0
  7. data/bin/turn_on +39 -0
  8. data/doc/classes/Tellstick/Tellstick.html +117 -0
  9. data/doc/classes/Tellstick/TellstickIO.html +265 -0
  10. data/doc/classes/Tellstick/TellstickIO.src/M000020.html +18 -0
  11. data/doc/classes/Tellstick/TellstickIO.src/M000021.html +20 -0
  12. data/doc/classes/Tellstick/TellstickIO.src/M000022.html +26 -0
  13. data/doc/classes/Tellstick/TellstickIO.src/M000023.html +19 -0
  14. data/doc/classes/Tellstick/TellstickIO.src/M000024.html +26 -0
  15. data/doc/classes/Tellstick/TellstickIO.src/M000025.html +16 -0
  16. data/doc/classes/Tellstick/TellstickIO.src/M000026.html +16 -0
  17. data/doc/classes/Tellstick/TellstickIO.src/M000027.html +24 -0
  18. data/doc/classes/Tellstick.html +204 -0
  19. data/doc/classes/Tellstick.src/M000019.html +25 -0
  20. data/doc/classes/TriggerSwitchD/Action.html +165 -0
  21. data/doc/classes/TriggerSwitchD/Action.src/M000015.html +28 -0
  22. data/doc/classes/TriggerSwitchD/Action.src/M000016.html +18 -0
  23. data/doc/classes/TriggerSwitchD/Application.html +203 -0
  24. data/doc/classes/TriggerSwitchD/Application.src/M000017.html +21 -0
  25. data/doc/classes/TriggerSwitchD/Application.src/M000018.html +40 -0
  26. data/doc/classes/TriggerSwitchD/ConfigFactory/Config.html +127 -0
  27. data/doc/classes/TriggerSwitchD/ConfigFactory/Config.src/M000014.html +23 -0
  28. data/doc/classes/TriggerSwitchD/ConfigFactory.html +141 -0
  29. data/doc/classes/TriggerSwitchD/ConfigFactory.src/M000013.html +24 -0
  30. data/doc/classes/TriggerSwitchD/IPC.html +134 -0
  31. data/doc/classes/TriggerSwitchD/IPC.src/M000012.html +32 -0
  32. data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.html +242 -0
  33. data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000005.html +19 -0
  34. data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000006.html +18 -0
  35. data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000007.html +23 -0
  36. data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000008.html +19 -0
  37. data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000009.html +19 -0
  38. data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000010.html +18 -0
  39. data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000011.html +18 -0
  40. data/doc/classes/TriggerSwitchD/Schedule.html +147 -0
  41. data/doc/classes/TriggerSwitchD/Schedule.src/M000004.html +19 -0
  42. data/doc/classes/TriggerSwitchD/SwitchFactory.html +135 -0
  43. data/doc/classes/TriggerSwitchD/SwitchFactory.src/M000003.html +20 -0
  44. data/doc/classes/TriggerSwitchD.html +212 -0
  45. data/doc/classes/TriggerSwitchD.src/M000001.html +22 -0
  46. data/doc/classes/TriggerSwitchD.src/M000002.html +27 -0
  47. data/doc/created.rid +1 -0
  48. data/doc/files/lib/tellstick/protocol/nexa_rb.html +126 -0
  49. data/doc/files/lib/tellstick/protocol/not_connected_rb.html +126 -0
  50. data/doc/files/lib/tellstick/protocol/null_protocol_rb.html +126 -0
  51. data/doc/files/lib/tellstick/protocol/plain_text_rb.html +126 -0
  52. data/doc/files/lib/tellstick/protocol/proove_rb.html +126 -0
  53. data/doc/files/lib/tellstick/protocol/protocol_loader_rb.html +126 -0
  54. data/doc/files/lib/tellstick/protocol/rising_sun_rb.html +126 -0
  55. data/doc/files/lib/tellstick/protocol/waveman_rb.html +126 -0
  56. data/doc/files/lib/tellstick/tellstick_io_rb.html +135 -0
  57. data/doc/files/lib/tellstick/tellstick_rb.html +135 -0
  58. data/doc/files/lib/tellstick_rb.html +134 -0
  59. data/doc/files/lib/trigger_switch_d/action_rb.html +126 -0
  60. data/doc/files/lib/trigger_switch_d/application_rb.html +136 -0
  61. data/doc/files/lib/trigger_switch_d/config_rb.html +126 -0
  62. data/doc/files/lib/trigger_switch_d/daylight_rb.html +126 -0
  63. data/doc/files/lib/trigger_switch_d/ipc_rb.html +126 -0
  64. data/doc/files/lib/trigger_switch_d/schedule_rb.html +126 -0
  65. data/doc/files/lib/trigger_switch_d/switch_rb.html +126 -0
  66. data/doc/files/lib/trigger_switch_d/trigger_switch_d_helper_rb.html +126 -0
  67. data/doc/files/lib/trigger_switch_d_rb.html +140 -0
  68. data/doc/fr_class_index.html +38 -0
  69. data/doc/fr_file_index.html +46 -0
  70. data/doc/fr_method_index.html +53 -0
  71. data/doc/index.html +24 -0
  72. data/features/execute_schedule.feature +20 -0
  73. data/features/group_aliases.feature +31 -0
  74. data/features/handle_switches.feature +36 -0
  75. data/features/listen_for_client_call.feature +23 -0
  76. data/features/persistent_schedule.feature +70 -0
  77. data/features/proove_protocol.feature +20 -0
  78. data/features/schedule.feature +25 -0
  79. data/features/simple_string_protocol.feature +35 -0
  80. data/features/step_definitions/execute_schedule_steps.rb +16 -0
  81. data/features/step_definitions/group_aliases_steps.rb +24 -0
  82. data/features/step_definitions/handle_switches_steps.rb +21 -0
  83. data/features/step_definitions/listen_for_client_call_steps.rb +34 -0
  84. data/features/step_definitions/persistent_schedule_steps.rb +18 -0
  85. data/features/step_definitions/proove_protocol_steps.rb +3 -0
  86. data/features/step_definitions/schedule_steps.rb +9 -0
  87. data/features/step_definitions/shared_steps.rb +75 -0
  88. data/features/step_definitions/simple_string_protocol_steps.rb +3 -0
  89. data/features/step_definitions/sunrise_steps.rb +22 -0
  90. data/features/step_definitions/tellstick_connected_steps.rb +21 -0
  91. data/features/sunrise.feature +22 -0
  92. data/features/sunset.feature +22 -0
  93. data/features/support/action_helpers.rb +10 -0
  94. data/features/support/env.rb +7 -0
  95. data/features/support/listen_for_client_call_helper.rb +71 -0
  96. data/features/support/proove_helpers.rb +6 -0
  97. data/features/support/sunrise_helper.rb +8 -0
  98. data/features/tellstick_connected.feature +14 -0
  99. data/lib/tellstick/protocol/nexa.rb +48 -0
  100. data/lib/tellstick/protocol/not_connected.rb +42 -0
  101. data/lib/tellstick/protocol/null_protocol.rb +41 -0
  102. data/lib/tellstick/protocol/plain_text.rb +35 -0
  103. data/lib/tellstick/protocol/proove.rb +83 -0
  104. data/lib/tellstick/protocol/protocol_loader.rb +26 -0
  105. data/lib/tellstick/protocol/rising_sun.rb +42 -0
  106. data/lib/tellstick/protocol/waveman.rb +29 -0
  107. data/lib/tellstick/tellstick.rb +73 -0
  108. data/lib/tellstick/tellstick_io.rb +80 -0
  109. data/lib/tellstick.rb +20 -0
  110. data/lib/trigger_switch_d/action.rb +83 -0
  111. data/lib/trigger_switch_d/application.rb +89 -0
  112. data/lib/trigger_switch_d/config.rb +83 -0
  113. data/lib/trigger_switch_d/daylight.rb +114 -0
  114. data/lib/trigger_switch_d/ipc.rb +39 -0
  115. data/lib/trigger_switch_d/schedule.rb +95 -0
  116. data/lib/trigger_switch_d/switch.rb +37 -0
  117. data/lib/trigger_switch_d/trigger_switch_d_helper.rb +44 -0
  118. data/lib/trigger_switch_d.rb +26 -0
  119. data/spec/spec_helper.rb +22 -0
  120. data/spec/tellstick/protocol/nexa_spec.rb +57 -0
  121. data/spec/tellstick/protocol/proove_spec.rb +61 -0
  122. data/spec/tellstick/protocol/rising_sun_spec.rb +56 -0
  123. data/spec/tellstick/protocol/waveman_spec.rb +57 -0
  124. data/spec/tellstick/tellstick_io_spec.rb +31 -0
  125. data/spec/tellstick/tellstick_spec.rb +86 -0
  126. data/spec/trigger_switch_d/application_spec.rb +144 -0
  127. data/spec/trigger_switch_d/config_spec.rb +94 -0
  128. data/spec/trigger_switch_d/daylight_spec.rb +39 -0
  129. data/spec/trigger_switch_d/ipc_spec.rb +119 -0
  130. data/spec/trigger_switch_d/schedule_spec.rb +103 -0
  131. data/spec/trigger_switch_d/trigger_switch_d_spec_helpers.rb +24 -0
  132. data/trigger_switch_d.gemspec +43 -0
  133. metadata +206 -0
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>environment (TriggerSwitchD::ConfigFactory::Config)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
10
+ <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/trigger_switch_d/config.rb, line 55</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Config</span>.<span class="ruby-identifier">environment</span>
15
+ <span class="ruby-identifier">result</span> = <span class="ruby-identifier">default_environment</span>
16
+ <span class="ruby-identifier">file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-constant">Config</span>.<span class="ruby-identifier">dsl_path</span>,<span class="ruby-value str">&quot;r&quot;</span>)
17
+ <span class="ruby-identifier">result</span>[<span class="ruby-identifier">:lookup</span>] = <span class="ruby-constant">YAML</span><span class="ruby-operator">::</span><span class="ruby-identifier">load</span>(<span class="ruby-identifier">file</span>)
18
+ <span class="ruby-identifier">file</span>.<span class="ruby-identifier">close</span>
19
+ <span class="ruby-identifier">result</span>[<span class="ruby-identifier">:at_location</span>] = <span class="ruby-constant">Config</span>.<span class="ruby-identifier">geo_position</span>
20
+ <span class="ruby-identifier">result</span>
21
+ <span class="ruby-keyword kw">end</span></pre>
22
+ </body>
23
+ </html>
@@ -0,0 +1,141 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: TriggerSwitchD::ConfigFactory</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">TriggerSwitchD::ConfigFactory</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/trigger_switch_d/config_rb.html">
59
+ lib/trigger_switch_d/config.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+
76
+
77
+ </div>
78
+
79
+ <div id="method-list">
80
+ <h3 class="section-bar">Methods</h3>
81
+
82
+ <div class="name-list">
83
+ <a href="#M000013">new</a>&nbsp;&nbsp;
84
+ </div>
85
+ </div>
86
+
87
+ </div>
88
+
89
+
90
+ <!-- if includes -->
91
+
92
+ <div id="section">
93
+
94
+ <div id="class-list">
95
+ <h3 class="section-bar">Classes and Modules</h3>
96
+
97
+ Module <a href="ConfigFactory/Config.html" class="link">TriggerSwitchD::ConfigFactory::Config</a><br />
98
+
99
+ </div>
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+ <!-- if method_list -->
108
+ <div id="methods">
109
+ <h3 class="section-bar">Public Class methods</h3>
110
+
111
+ <div id="method-M000013" class="method-detail">
112
+ <a name="M000013"></a>
113
+
114
+ <div class="method-heading">
115
+ <a href="ConfigFactory.src/M000013.html" target="Code" class="method-signature"
116
+ onclick="popupCode('ConfigFactory.src/M000013.html');return false;">
117
+ <span class="method-name">new</span><span class="method-args">(file=StringIO.new)</span>
118
+ </a>
119
+ </div>
120
+
121
+ <div class="method-description">
122
+ <p>
123
+ Creates the <a href="ConfigFactory/Config.html">Config</a> class from the
124
+ config/config.rb file See samples/config.rb for more documentation
125
+ </p>
126
+ </div>
127
+ </div>
128
+
129
+
130
+ </div>
131
+
132
+
133
+ </div>
134
+
135
+
136
+ <div id="validator-badges">
137
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
138
+ </div>
139
+
140
+ </body>
141
+ </html>
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>new (TriggerSwitchD::ConfigFactory)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/trigger_switch_d/config.rb, line 23</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">file</span>=<span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>)
15
+ <span class="ruby-identifier">env</span> = <span class="ruby-identifier">file</span>.<span class="ruby-identifier">readlines</span>
16
+ <span class="ruby-identifier">attributes</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">attribute</span><span class="ruby-operator">|</span>
17
+ <span class="ruby-identifier">attribute</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/Config.([\w_]+) =/</span>).<span class="ruby-identifier">flatten</span>[<span class="ruby-value">0</span>]
18
+ <span class="ruby-keyword kw">end</span>
19
+ <span class="ruby-identifier">cls</span> = <span class="ruby-value str">&quot;class Config\n\#{attributes.map {|name| \&quot;def self.\#{name}=(value); \#{append_filenames(name)}; end\&quot;}.join(\&quot;\\n\&quot;)}\n\n\#{attributes.map {|name| \&quot;def self.\#{name}; @\#{name}; end\&quot;}.join(\&quot;\\n\&quot;)}\n\ndef self.default_environment\n{:lookup =&gt; {\&quot;t\303\244nd\&quot; =&gt; \&quot;activate\&quot;,\n\&quot;sl\303\244ck\&quot; =&gt; \&quot;deactivate\&quot;,\n\&quot;soluppg\303\245ng\&quot; =&gt; \&quot;sunrise\&quot;,\n\&quot;solnedg\303\245ng\&quot; =&gt; \&quot;sunset\&quot;,\n\&quot;klockan\&quot; =&gt; \&quot;at\&quot;,\n\&quot;vid\&quot; =&gt; \&quot;at\&quot;},\n:at_location =&gt; {:north =&gt; 0.0, :west =&gt; 0.0}}\nend\nend\n&quot;</span>
20
+ <span class="ruby-operator">::</span><span class="ruby-constant">TriggerSwitchD</span>.<span class="ruby-identifier">module_eval</span>(<span class="ruby-identifier">cls</span>)
21
+ <span class="ruby-identifier">setup_environment</span>(<span class="ruby-identifier">env</span>)
22
+ <span class="ruby-keyword kw">end</span></pre>
23
+ </body>
24
+ </html>
@@ -0,0 +1,134 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: TriggerSwitchD::IPC</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">TriggerSwitchD::IPC</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/trigger_switch_d/ipc_rb.html">
59
+ lib/trigger_switch_d/ipc.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+
76
+
77
+ </div>
78
+
79
+ <div id="method-list">
80
+ <h3 class="section-bar">Methods</h3>
81
+
82
+ <div class="name-list">
83
+ <a href="#M000012">create</a>&nbsp;&nbsp;
84
+ </div>
85
+ </div>
86
+
87
+ </div>
88
+
89
+
90
+ <!-- if includes -->
91
+
92
+ <div id="section">
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+ <!-- if method_list -->
102
+ <div id="methods">
103
+ <h3 class="section-bar">Public Class methods</h3>
104
+
105
+ <div id="method-M000012" class="method-detail">
106
+ <a name="M000012"></a>
107
+
108
+ <div class="method-heading">
109
+ <a href="IPC.src/M000012.html" target="Code" class="method-signature"
110
+ onclick="popupCode('IPC.src/M000012.html');return false;">
111
+ <span class="method-name">create</span><span class="method-args">(socket_path)</span>
112
+ </a>
113
+ </div>
114
+
115
+ <div class="method-description">
116
+ <p>
117
+ unix socket thread, see README.rdoc for usage
118
+ </p>
119
+ </div>
120
+ </div>
121
+
122
+
123
+ </div>
124
+
125
+
126
+ </div>
127
+
128
+
129
+ <div id="validator-badges">
130
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
131
+ </div>
132
+
133
+ </body>
134
+ </html>
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>create (TriggerSwitchD::IPC)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/trigger_switch_d/ipc.rb, line 21</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">create</span>(<span class="ruby-identifier">socket_path</span>)
15
+ <span class="ruby-constant">File</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">socket_path</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span> <span class="ruby-identifier">socket_path</span>
16
+ <span class="ruby-identifier">sock</span> = <span class="ruby-constant">UNIXServer</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">socket_path</span>)
17
+ <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">sock</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sock</span><span class="ruby-operator">|</span>
18
+ <span class="ruby-keyword kw">while</span>(<span class="ruby-operator">!</span>[<span class="ruby-value str">&quot;stop&quot;</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-value str">&quot;received&quot;</span>]))
19
+ <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-value str">&quot;received&quot;</span>] = <span class="ruby-value str">&quot;&quot;</span>
20
+ <span class="ruby-identifier">s1</span> = <span class="ruby-identifier">sock</span>.<span class="ruby-identifier">accept</span>
21
+ <span class="ruby-keyword kw">while</span>(<span class="ruby-operator">!</span>[<span class="ruby-value str">&quot;stop&quot;</span>,<span class="ruby-value str">&quot;bye&quot;</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-value str">&quot;received&quot;</span>]))
22
+ <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-value str">&quot;received&quot;</span>] = <span class="ruby-identifier">s1</span>.<span class="ruby-identifier">recvfrom</span>(<span class="ruby-value">200</span>)[<span class="ruby-value">0</span>]
23
+ <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-value str">&quot;response&quot;</span>] = <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-value str">&quot;received&quot;</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-value str">&quot;received&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;bye&quot;</span>
24
+ <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">stop</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span>[<span class="ruby-value str">&quot;bye&quot;</span>,<span class="ruby-value str">&quot;&quot;</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-value str">&quot;received&quot;</span>])
25
+ <span class="ruby-identifier">s1</span>.<span class="ruby-identifier">send</span>(<span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-value str">&quot;response&quot;</span>],<span class="ruby-value">0</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-value str">&quot;received&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
26
+ <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-value str">&quot;received&quot;</span>] = <span class="ruby-value str">&quot;bye&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-value str">&quot;received&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
27
+ <span class="ruby-keyword kw">end</span>
28
+ <span class="ruby-keyword kw">end</span>
29
+ <span class="ruby-keyword kw">end</span>
30
+ <span class="ruby-keyword kw">end</span></pre>
31
+ </body>
32
+ </html>
@@ -0,0 +1,242 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: TriggerSwitchD::Schedule::InstanceMethods</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">TriggerSwitchD::Schedule::InstanceMethods</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../files/lib/trigger_switch_d/schedule_rb.html">
59
+ lib/trigger_switch_d/schedule.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+
76
+
77
+ </div>
78
+
79
+ <div id="method-list">
80
+ <h3 class="section-bar">Methods</h3>
81
+
82
+ <div class="name-list">
83
+ <a href="#M000011">by_name</a>&nbsp;&nbsp;
84
+ <a href="#M000010">cronological</a>&nbsp;&nbsp;
85
+ <a href="#M000008">delete</a>&nbsp;&nbsp;
86
+ <a href="#M000009">execute</a>&nbsp;&nbsp;
87
+ <a href="#M000006">find</a>&nbsp;&nbsp;
88
+ <a href="#M000007">next_action_at</a>&nbsp;&nbsp;
89
+ <a href="#M000005">schedule_action</a>&nbsp;&nbsp;
90
+ </div>
91
+ </div>
92
+
93
+ </div>
94
+
95
+
96
+ <!-- if includes -->
97
+
98
+ <div id="section">
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+ <!-- if method_list -->
108
+ <div id="methods">
109
+ <h3 class="section-bar">Public Instance methods</h3>
110
+
111
+ <div id="method-M000011" class="method-detail">
112
+ <a name="M000011"></a>
113
+
114
+ <div class="method-heading">
115
+ <a href="InstanceMethods.src/M000011.html" target="Code" class="method-signature"
116
+ onclick="popupCode('InstanceMethods.src/M000011.html');return false;">
117
+ <span class="method-name">by_name</span><span class="method-args">()</span>
118
+ </a>
119
+ </div>
120
+
121
+ <div class="method-description">
122
+ <p>
123
+ Hash of actions accessible by name
124
+ </p>
125
+ </div>
126
+ </div>
127
+
128
+ <div id="method-M000010" class="method-detail">
129
+ <a name="M000010"></a>
130
+
131
+ <div class="method-heading">
132
+ <a href="InstanceMethods.src/M000010.html" target="Code" class="method-signature"
133
+ onclick="popupCode('InstanceMethods.src/M000010.html');return false;">
134
+ <span class="method-name">cronological</span><span class="method-args">()</span>
135
+ </a>
136
+ </div>
137
+
138
+ <div class="method-description">
139
+ <p>
140
+ Hash of actions accessible by &quot;HH:MM&quot; format
141
+ </p>
142
+ </div>
143
+ </div>
144
+
145
+ <div id="method-M000008" class="method-detail">
146
+ <a name="M000008"></a>
147
+
148
+ <div class="method-heading">
149
+ <a href="InstanceMethods.src/M000008.html" target="Code" class="method-signature"
150
+ onclick="popupCode('InstanceMethods.src/M000008.html');return false;">
151
+ <span class="method-name">delete</span><span class="method-args">(name)</span>
152
+ </a>
153
+ </div>
154
+
155
+ <div class="method-description">
156
+ <p>
157
+ deletes action from schedule, returning the action on exit
158
+ </p>
159
+ </div>
160
+ </div>
161
+
162
+ <div id="method-M000009" class="method-detail">
163
+ <a name="M000009"></a>
164
+
165
+ <div class="method-heading">
166
+ <a href="InstanceMethods.src/M000009.html" target="Code" class="method-signature"
167
+ onclick="popupCode('InstanceMethods.src/M000009.html');return false;">
168
+ <span class="method-name">execute</span><span class="method-args">(at,output)</span>
169
+ </a>
170
+ </div>
171
+
172
+ <div class="method-description">
173
+ <p>
174
+ Executes action and removes it from the schedule
175
+ </p>
176
+ </div>
177
+ </div>
178
+
179
+ <div id="method-M000006" class="method-detail">
180
+ <a name="M000006"></a>
181
+
182
+ <div class="method-heading">
183
+ <a href="InstanceMethods.src/M000006.html" target="Code" class="method-signature"
184
+ onclick="popupCode('InstanceMethods.src/M000006.html');return false;">
185
+ <span class="method-name">find</span><span class="method-args">(name)</span>
186
+ </a>
187
+ </div>
188
+
189
+ <div class="method-description">
190
+ <p>
191
+ <a href="InstanceMethods.html#M000006">find</a> by name
192
+ </p>
193
+ </div>
194
+ </div>
195
+
196
+ <div id="method-M000007" class="method-detail">
197
+ <a name="M000007"></a>
198
+
199
+ <div class="method-heading">
200
+ <a href="InstanceMethods.src/M000007.html" target="Code" class="method-signature"
201
+ onclick="popupCode('InstanceMethods.src/M000007.html');return false;">
202
+ <span class="method-name">next_action_at</span><span class="method-args">(hour_minute)</span>
203
+ </a>
204
+ </div>
205
+
206
+ <div class="method-description">
207
+ <p>
208
+ Returns when the next action is scheduled to occur based on the
209
+ hour_minute. The format is &quot;HH:MM&quot; for both hour_minute as well
210
+ as the result, with the exception that if no next action is found it will
211
+ return &quot;23:59:59&quot;
212
+ </p>
213
+ </div>
214
+ </div>
215
+
216
+ <div id="method-M000005" class="method-detail">
217
+ <a name="M000005"></a>
218
+
219
+ <div class="method-heading">
220
+ <a href="InstanceMethods.src/M000005.html" target="Code" class="method-signature"
221
+ onclick="popupCode('InstanceMethods.src/M000005.html');return false;">
222
+ <span class="method-name">schedule_action</span><span class="method-args">(action)</span>
223
+ </a>
224
+ </div>
225
+
226
+ <div class="method-description">
227
+ </div>
228
+ </div>
229
+
230
+
231
+ </div>
232
+
233
+
234
+ </div>
235
+
236
+
237
+ <div id="validator-badges">
238
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
239
+ </div>
240
+
241
+ </body>
242
+ </html>
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>schedule_action (TriggerSwitchD::Schedule::InstanceMethods)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
10
+ <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/trigger_switch_d/schedule.rb, line 26</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">schedule_action</span>(<span class="ruby-identifier">action</span>)
15
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">_insert_action_</span>(<span class="ruby-identifier">action</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">find</span>(<span class="ruby-identifier">action</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
16
+ <span class="ruby-identifier">find</span>(<span class="ruby-identifier">action</span>.<span class="ruby-identifier">to_s</span>)
17
+ <span class="ruby-keyword kw">end</span></pre>
18
+ </body>
19
+ </html>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>find (TriggerSwitchD::Schedule::InstanceMethods)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
10
+ <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/trigger_switch_d/schedule.rb, line 32</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find</span>(<span class="ruby-identifier">name</span>)
15
+ <span class="ruby-identifier">by_name</span>[<span class="ruby-identifier">name</span>]
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>