nanook 0.7.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/CHANGELOG.md +26 -0
  4. data/Gemfile.lock +2 -2
  5. data/README.md +18 -7
  6. data/Rakefile +18 -0
  7. data/docs/0.7.0/apple-touch-icon.png +0 -0
  8. data/docs/0.7.0/classes/Nanook.html +572 -0
  9. data/docs/0.7.0/classes/Nanook/Account.html +909 -0
  10. data/docs/0.7.0/classes/Nanook/Block.html +717 -0
  11. data/docs/0.7.0/classes/Nanook/Error.html +84 -0
  12. data/docs/0.7.0/classes/Nanook/Key.html +253 -0
  13. data/docs/0.7.0/classes/Nanook/Node.html +657 -0
  14. data/docs/0.7.0/classes/Nanook/Rpc.html +247 -0
  15. data/docs/0.7.0/classes/Nanook/Util.html +197 -0
  16. data/docs/0.7.0/classes/Nanook/Wallet.html +986 -0
  17. data/docs/0.7.0/classes/Nanook/WalletAccount.html +446 -0
  18. data/docs/0.7.0/classes/Nanook/WorkPeer.html +294 -0
  19. data/docs/0.7.0/created.rid +14 -0
  20. data/docs/0.7.0/css/github.css +123 -0
  21. data/docs/0.7.0/css/main.css +374 -0
  22. data/docs/0.7.0/css/panel.css +360 -0
  23. data/docs/0.7.0/css/reset.css +48 -0
  24. data/docs/0.7.0/favicon.ico +0 -0
  25. data/docs/0.7.0/files/README_md.html +418 -0
  26. data/docs/0.7.0/files/lib/nanook/account_rb.html +89 -0
  27. data/docs/0.7.0/files/lib/nanook/block_rb.html +89 -0
  28. data/docs/0.7.0/files/lib/nanook/error_rb.html +89 -0
  29. data/docs/0.7.0/files/lib/nanook/key_rb.html +89 -0
  30. data/docs/0.7.0/files/lib/nanook/node_rb.html +89 -0
  31. data/docs/0.7.0/files/lib/nanook/rpc_rb.html +99 -0
  32. data/docs/0.7.0/files/lib/nanook/util_rb.html +89 -0
  33. data/docs/0.7.0/files/lib/nanook/version_rb.html +84 -0
  34. data/docs/0.7.0/files/lib/nanook/wallet_account_rb.html +89 -0
  35. data/docs/0.7.0/files/lib/nanook/wallet_rb.html +89 -0
  36. data/docs/0.7.0/files/lib/nanook/work_peer_rb.html +89 -0
  37. data/docs/0.7.0/files/lib/nanook_rb.html +94 -0
  38. data/docs/0.7.0/i/arrow-down.svg +8 -0
  39. data/docs/0.7.0/i/arrow-right.svg +8 -0
  40. data/docs/0.7.0/i/search.svg +12 -0
  41. data/docs/0.7.0/i/tree_bg.svg +8 -0
  42. data/docs/0.7.0/index.html +11 -0
  43. data/docs/0.7.0/js/highlight.pack.js +1 -0
  44. data/docs/0.7.0/js/jquery-1.3.2.min.js +19 -0
  45. data/docs/0.7.0/js/main.js +25 -0
  46. data/docs/0.7.0/js/navigation.js +142 -0
  47. data/docs/0.7.0/js/search_index.js +1 -0
  48. data/docs/0.7.0/js/searchdoc.js +465 -0
  49. data/docs/0.7.0/js/searcher.js +229 -0
  50. data/docs/0.7.0/panel/index.html +47 -0
  51. data/docs/0.7.0/panel/links.html +32 -0
  52. data/docs/0.7.0/panel/tree.js +1 -0
  53. data/docs/0.8.0/apple-touch-icon.png +0 -0
  54. data/docs/0.8.0/classes/Nanook.html +621 -0
  55. data/docs/0.8.0/classes/Nanook/Account.html +971 -0
  56. data/docs/0.8.0/classes/Nanook/Block.html +759 -0
  57. data/docs/0.8.0/classes/Nanook/Error.html +84 -0
  58. data/docs/0.8.0/classes/Nanook/Key.html +295 -0
  59. data/docs/0.8.0/classes/Nanook/Node.html +657 -0
  60. data/docs/0.8.0/classes/Nanook/Rpc.html +247 -0
  61. data/docs/0.8.0/classes/Nanook/Util.html +264 -0
  62. data/docs/0.8.0/classes/Nanook/Wallet.html +1056 -0
  63. data/docs/0.8.0/classes/Nanook/WalletAccount.html +582 -0
  64. data/docs/0.8.0/classes/Nanook/WorkPeer.html +294 -0
  65. data/docs/0.8.0/created.rid +14 -0
  66. data/docs/0.8.0/css/github.css +123 -0
  67. data/docs/0.8.0/css/main.css +374 -0
  68. data/docs/0.8.0/css/panel.css +360 -0
  69. data/docs/0.8.0/css/reset.css +48 -0
  70. data/docs/0.8.0/favicon.ico +0 -0
  71. data/docs/0.8.0/files/README_md.html +423 -0
  72. data/docs/0.8.0/files/lib/nanook/account_rb.html +89 -0
  73. data/docs/0.8.0/files/lib/nanook/block_rb.html +89 -0
  74. data/docs/0.8.0/files/lib/nanook/error_rb.html +89 -0
  75. data/docs/0.8.0/files/lib/nanook/key_rb.html +89 -0
  76. data/docs/0.8.0/files/lib/nanook/node_rb.html +89 -0
  77. data/docs/0.8.0/files/lib/nanook/rpc_rb.html +99 -0
  78. data/docs/0.8.0/files/lib/nanook/util_rb.html +97 -0
  79. data/docs/0.8.0/files/lib/nanook/version_rb.html +84 -0
  80. data/docs/0.8.0/files/lib/nanook/wallet_account_rb.html +89 -0
  81. data/docs/0.8.0/files/lib/nanook/wallet_rb.html +89 -0
  82. data/docs/0.8.0/files/lib/nanook/work_peer_rb.html +89 -0
  83. data/docs/0.8.0/files/lib/nanook_rb.html +94 -0
  84. data/docs/0.8.0/i/arrow-down.svg +8 -0
  85. data/docs/0.8.0/i/arrow-right.svg +8 -0
  86. data/docs/0.8.0/i/search.svg +12 -0
  87. data/docs/0.8.0/i/tree_bg.svg +8 -0
  88. data/docs/0.8.0/index.html +11 -0
  89. data/docs/0.8.0/js/highlight.pack.js +1 -0
  90. data/docs/0.8.0/js/jquery-1.3.2.min.js +19 -0
  91. data/docs/0.8.0/js/main.js +25 -0
  92. data/docs/0.8.0/js/navigation.js +142 -0
  93. data/docs/0.8.0/js/search_index.js +1 -0
  94. data/docs/0.8.0/js/searchdoc.js +465 -0
  95. data/docs/0.8.0/js/searcher.js +229 -0
  96. data/docs/0.8.0/panel/index.html +47 -0
  97. data/docs/0.8.0/panel/links.html +32 -0
  98. data/docs/0.8.0/panel/tree.js +1 -0
  99. data/docs/1.0.0/apple-touch-icon.png +0 -0
  100. data/docs/1.0.0/classes/Nanook.html +621 -0
  101. data/docs/1.0.0/classes/Nanook/Account.html +971 -0
  102. data/docs/1.0.0/classes/Nanook/Block.html +759 -0
  103. data/docs/1.0.0/classes/Nanook/Error.html +84 -0
  104. data/docs/1.0.0/classes/Nanook/Key.html +295 -0
  105. data/docs/1.0.0/classes/Nanook/Node.html +657 -0
  106. data/docs/1.0.0/classes/Nanook/Rpc.html +247 -0
  107. data/docs/1.0.0/classes/Nanook/Util.html +264 -0
  108. data/docs/1.0.0/classes/Nanook/Wallet.html +1056 -0
  109. data/docs/1.0.0/classes/Nanook/WalletAccount.html +582 -0
  110. data/docs/1.0.0/classes/Nanook/WorkPeer.html +294 -0
  111. data/docs/1.0.0/created.rid +14 -0
  112. data/docs/1.0.0/css/github.css +123 -0
  113. data/docs/1.0.0/css/main.css +374 -0
  114. data/docs/1.0.0/css/panel.css +360 -0
  115. data/docs/1.0.0/css/reset.css +48 -0
  116. data/docs/1.0.0/favicon.ico +0 -0
  117. data/docs/1.0.0/files/README_md.html +423 -0
  118. data/docs/1.0.0/files/lib/nanook/account_rb.html +89 -0
  119. data/docs/1.0.0/files/lib/nanook/block_rb.html +89 -0
  120. data/docs/1.0.0/files/lib/nanook/error_rb.html +89 -0
  121. data/docs/1.0.0/files/lib/nanook/key_rb.html +89 -0
  122. data/docs/1.0.0/files/lib/nanook/node_rb.html +89 -0
  123. data/docs/1.0.0/files/lib/nanook/rpc_rb.html +99 -0
  124. data/docs/1.0.0/files/lib/nanook/util_rb.html +97 -0
  125. data/docs/1.0.0/files/lib/nanook/version_rb.html +84 -0
  126. data/docs/1.0.0/files/lib/nanook/wallet_account_rb.html +89 -0
  127. data/docs/1.0.0/files/lib/nanook/wallet_rb.html +89 -0
  128. data/docs/1.0.0/files/lib/nanook/work_peer_rb.html +89 -0
  129. data/docs/1.0.0/files/lib/nanook_rb.html +94 -0
  130. data/docs/1.0.0/i/arrow-down.svg +8 -0
  131. data/docs/1.0.0/i/arrow-right.svg +8 -0
  132. data/docs/1.0.0/i/search.svg +12 -0
  133. data/docs/1.0.0/i/tree_bg.svg +8 -0
  134. data/docs/1.0.0/index.html +11 -0
  135. data/docs/1.0.0/js/highlight.pack.js +1 -0
  136. data/docs/1.0.0/js/jquery-1.3.2.min.js +19 -0
  137. data/docs/1.0.0/js/main.js +25 -0
  138. data/docs/1.0.0/js/navigation.js +142 -0
  139. data/docs/1.0.0/js/search_index.js +1 -0
  140. data/docs/1.0.0/js/searchdoc.js +465 -0
  141. data/docs/1.0.0/js/searcher.js +229 -0
  142. data/docs/1.0.0/panel/index.html +47 -0
  143. data/docs/1.0.0/panel/links.html +32 -0
  144. data/docs/1.0.0/panel/tree.js +1 -0
  145. data/docs/apple-touch-icon.png +0 -0
  146. data/docs/classes/Nanook.html +572 -0
  147. data/docs/classes/Nanook/Account.html +907 -0
  148. data/docs/classes/Nanook/Block.html +717 -0
  149. data/docs/classes/Nanook/Error.html +84 -0
  150. data/docs/classes/Nanook/Key.html +253 -0
  151. data/docs/classes/Nanook/Node.html +657 -0
  152. data/docs/classes/Nanook/Rpc.html +247 -0
  153. data/docs/classes/Nanook/Util.html +197 -0
  154. data/docs/classes/Nanook/Wallet.html +778 -0
  155. data/docs/classes/Nanook/WalletAccount.html +447 -0
  156. data/docs/classes/Nanook/WorkPeer.html +294 -0
  157. data/docs/created.rid +14 -0
  158. data/docs/css/github.css +123 -0
  159. data/docs/css/main.css +374 -0
  160. data/docs/css/panel.css +360 -0
  161. data/docs/css/reset.css +48 -0
  162. data/docs/favicon.ico +0 -0
  163. data/docs/files/README_md.html +408 -0
  164. data/docs/files/lib/nanook/account_rb.html +89 -0
  165. data/docs/files/lib/nanook/block_rb.html +89 -0
  166. data/docs/files/lib/nanook/error_rb.html +89 -0
  167. data/docs/files/lib/nanook/key_rb.html +89 -0
  168. data/docs/files/lib/nanook/node_rb.html +89 -0
  169. data/docs/files/lib/nanook/rpc_rb.html +99 -0
  170. data/docs/files/lib/nanook/util_rb.html +89 -0
  171. data/docs/files/lib/nanook/version_rb.html +84 -0
  172. data/docs/files/lib/nanook/wallet_account_rb.html +89 -0
  173. data/docs/files/lib/nanook/wallet_rb.html +89 -0
  174. data/docs/files/lib/nanook/work_peer_rb.html +89 -0
  175. data/docs/files/lib/nanook_rb.html +94 -0
  176. data/docs/i/arrow-down.svg +8 -0
  177. data/docs/i/arrow-right.svg +8 -0
  178. data/docs/i/search.svg +12 -0
  179. data/docs/i/tree_bg.svg +8 -0
  180. data/docs/index.html +11 -0
  181. data/docs/js/highlight.pack.js +1 -0
  182. data/docs/js/jquery-1.3.2.min.js +19 -0
  183. data/docs/js/main.js +25 -0
  184. data/docs/js/navigation.js +142 -0
  185. data/docs/js/search_index.js +1 -0
  186. data/docs/js/searchdoc.js +465 -0
  187. data/docs/js/searcher.js +229 -0
  188. data/docs/panel/index.html +47 -0
  189. data/docs/panel/links.html +32 -0
  190. data/docs/panel/tree.js +1 -0
  191. data/lib/nanook.rb +40 -4
  192. data/lib/nanook/account.rb +250 -8
  193. data/lib/nanook/block.rb +25 -2
  194. data/lib/nanook/key.rb +10 -2
  195. data/lib/nanook/node.rb +4 -0
  196. data/lib/nanook/rpc.rb +5 -1
  197. data/lib/nanook/util.rb +9 -1
  198. data/lib/nanook/version.rb +1 -1
  199. data/lib/nanook/wallet.rb +275 -14
  200. data/lib/nanook/wallet_account.rb +63 -11
  201. data/lib/nanook/work_peer.rb +4 -0
  202. metadata +188 -3
@@ -0,0 +1,247 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>Nanook::Rpc</title>
5
+ <meta charset="UTF-8" />
6
+ <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
7
+ <link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
8
+ <link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
9
+ <script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
10
+ <script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
11
+ <script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
12
+
13
+
14
+ <meta property="og:title" value="Nanook::Rpc">
15
+
16
+
17
+
18
+ <meta name="keywords" content="Nanook::Rpc class">
19
+
20
+ <meta name="keywords" content="new, call">
21
+
22
+ </head>
23
+
24
+ <body>
25
+ <div class="banner">
26
+
27
+ <h1>
28
+ <span class="type">Class</span>
29
+ Nanook::Rpc
30
+
31
+ <span class="parent">&lt;
32
+
33
+ Object
34
+
35
+ </span>
36
+
37
+ </h1>
38
+ <ul class="files">
39
+
40
+ <li><a href="../../files/lib/nanook/rpc_rb.html">lib/nanook/rpc.rb</a></li>
41
+
42
+ </ul>
43
+ </div>
44
+ <div id="bodyContent">
45
+ <div id="content">
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+ <!-- Method ref -->
61
+ <div class="sectiontitle">Methods</div>
62
+ <dl class="methods">
63
+
64
+ <dt>C</dt>
65
+ <dd>
66
+ <ul>
67
+
68
+
69
+ <li>
70
+ <a href="#method-i-call">call</a>
71
+ </li>
72
+
73
+ </ul>
74
+ </dd>
75
+
76
+ <dt>N</dt>
77
+ <dd>
78
+ <ul>
79
+
80
+
81
+ <li>
82
+ <a href="#method-c-new">new</a>
83
+ </li>
84
+
85
+ </ul>
86
+ </dd>
87
+
88
+ </dl>
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+ <!-- Section constants -->
103
+ <div class="sectiontitle">Constants</div>
104
+ <table border='0' cellpadding='5'>
105
+
106
+ <tr valign='top'>
107
+ <td class="attr-name">DEFAULT_TIMEOUT</td>
108
+ <td>=</td>
109
+ <td class="attr-value">500</td>
110
+ </tr>
111
+
112
+ <tr valign='top'>
113
+ <td>&nbsp;</td>
114
+ <td colspan="2" class="attr-desc"></td>
115
+ </tr>
116
+
117
+
118
+ <tr valign='top'>
119
+ <td class="attr-name">DEFAULT_URI</td>
120
+ <td>=</td>
121
+ <td class="attr-value">&quot;http://localhost:7076&quot;</td>
122
+ </tr>
123
+
124
+ <tr valign='top'>
125
+ <td>&nbsp;</td>
126
+ <td colspan="2" class="attr-desc"></td>
127
+ </tr>
128
+
129
+
130
+ </table>
131
+
132
+
133
+
134
+
135
+
136
+
137
+ <!-- Methods -->
138
+
139
+ <div class="sectiontitle">Class Public methods</div>
140
+
141
+ <div class="method">
142
+ <div class="title method-title" id="method-c-new">
143
+
144
+ <b>new</b>(uri=DEFAULT_URI, timeout:DEFAULT_TIMEOUT)
145
+
146
+ <a href="../../classes/Nanook/Rpc.html#method-c-new" name="method-c-new" class="permalink">Link</a>
147
+ </div>
148
+
149
+
150
+ <div class="description">
151
+
152
+ </div>
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+ <div class="sourcecode">
162
+
163
+ <p class="source-link">
164
+ Source:
165
+ <a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
166
+
167
+ </p>
168
+ <div id="method-c-new_source" class="dyn-source">
169
+ <pre><span class="ruby-comment"># File lib/nanook/rpc.rb, line 10</span>
170
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">uri</span>=<span class="ruby-constant">DEFAULT_URI</span>, <span class="ruby-value">timeout:</span><span class="ruby-constant">DEFAULT_TIMEOUT</span>)
171
+ <span class="ruby-identifier">rpc_server</span> = <span class="ruby-constant">URI</span>(<span class="ruby-identifier">uri</span>)
172
+
173
+ <span class="ruby-keyword">unless</span> [<span class="ruby-string">&#39;http&#39;</span>, <span class="ruby-string">&#39;https&#39;</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">rpc_server</span>.<span class="ruby-identifier">scheme</span>)
174
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;URI must have http or https in it. Was given: #{uri}&quot;</span>)
175
+ <span class="ruby-keyword">end</span>
176
+
177
+ <span class="ruby-ivar">@http</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">rpc_server</span>.<span class="ruby-identifier">host</span>, <span class="ruby-identifier">rpc_server</span>.<span class="ruby-identifier">port</span>)
178
+ <span class="ruby-ivar">@http</span>.<span class="ruby-identifier">read_timeout</span> = <span class="ruby-identifier">timeout</span>
179
+ <span class="ruby-ivar">@request</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Post</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">rpc_server</span>.<span class="ruby-identifier">request_uri</span>, {<span class="ruby-string">&quot;user-agent&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;Ruby nanook gem&quot;</span>})
180
+ <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">content_type</span> = <span class="ruby-string">&quot;application/json&quot;</span>
181
+ <span class="ruby-keyword">end</span></pre>
182
+ </div>
183
+ </div>
184
+
185
+ </div>
186
+
187
+
188
+
189
+ <div class="sectiontitle">Instance Public methods</div>
190
+
191
+ <div class="method">
192
+ <div class="title method-title" id="method-i-call">
193
+
194
+ <b>call</b>(action, params={})
195
+
196
+ <a href="../../classes/Nanook/Rpc.html#method-i-call" name="method-i-call" class="permalink">Link</a>
197
+ </div>
198
+
199
+
200
+ <div class="description">
201
+
202
+ </div>
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+ <div class="sourcecode">
212
+
213
+ <p class="source-link">
214
+ Source:
215
+ <a href="javascript:toggleSource('method-i-call_source')" id="l_method-i-call_source">show</a>
216
+
217
+ </p>
218
+ <div id="method-i-call_source" class="dyn-source">
219
+ <pre><span class="ruby-comment"># File lib/nanook/rpc.rb, line 23</span>
220
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">call</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">params</span>={})
221
+ <span class="ruby-comment"># Stringify param values</span>
222
+ <span class="ruby-identifier">params</span> = <span class="ruby-constant">Hash</span>[<span class="ruby-identifier">params</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> [<span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_s</span>] }]
223
+
224
+ <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">body</span> = { <span class="ruby-value">action:</span> <span class="ruby-identifier">action</span> }.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">params</span>).<span class="ruby-identifier">to_json</span>
225
+
226
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@http</span>.<span class="ruby-identifier">request</span>(<span class="ruby-ivar">@request</span>)
227
+
228
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTPSuccess</span>)
229
+ <span class="ruby-identifier">hash</span> = <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>)
230
+ <span class="ruby-identifier">process_hash</span>(<span class="ruby-identifier">hash</span>)
231
+ <span class="ruby-keyword">else</span>
232
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;Encountered net/http error #{response.code}: #{response.class.name}&quot;</span>)
233
+ <span class="ruby-keyword">end</span>
234
+ <span class="ruby-keyword">end</span></pre>
235
+ </div>
236
+ </div>
237
+
238
+ </div>
239
+
240
+
241
+
242
+
243
+ </div>
244
+
245
+ </div>
246
+ </body>
247
+ </html>
@@ -0,0 +1,264 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>Nanook::Util</title>
5
+ <meta charset="UTF-8" />
6
+ <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
7
+ <link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
8
+ <link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
9
+ <script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
10
+ <script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
11
+ <script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
12
+
13
+
14
+ <meta property="og:title" value="Nanook::Util">
15
+
16
+
17
+
18
+ <meta name="keywords" content="Nanook::Util class">
19
+
20
+ <meta name="keywords" content="NANO_to_raw, raw_to_NANO, coerce_empty_string_to_type">
21
+
22
+ </head>
23
+
24
+ <body>
25
+ <div class="banner">
26
+
27
+ <h1>
28
+ <span class="type">Class</span>
29
+ Nanook::Util
30
+
31
+ <span class="parent">&lt;
32
+
33
+ Object
34
+
35
+ </span>
36
+
37
+ </h1>
38
+ <ul class="files">
39
+
40
+ <li><a href="../../files/lib/nanook/util_rb.html">lib/nanook/util.rb</a></li>
41
+
42
+ </ul>
43
+ </div>
44
+ <div id="bodyContent">
45
+ <div id="content">
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+ <!-- Method ref -->
61
+ <div class="sectiontitle">Methods</div>
62
+ <dl class="methods">
63
+
64
+ <dt>N</dt>
65
+ <dd>
66
+ <ul>
67
+
68
+
69
+ <li>
70
+ <a href="#method-c-NANO_to_raw">NANO_to_raw</a>
71
+ </li>
72
+
73
+ </ul>
74
+ </dd>
75
+
76
+ <dt>C</dt>
77
+ <dd>
78
+ <ul>
79
+
80
+
81
+ <li>
82
+ <a href="#method-c-coerce_empty_string_to_type">coerce_empty_string_to_type</a>
83
+ </li>
84
+
85
+ </ul>
86
+ </dd>
87
+
88
+ <dt>R</dt>
89
+ <dd>
90
+ <ul>
91
+
92
+
93
+ <li>
94
+ <a href="#method-c-raw_to_NANO">raw_to_NANO</a>
95
+ </li>
96
+
97
+ </ul>
98
+ </dd>
99
+
100
+ </dl>
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+ <!-- Section constants -->
115
+ <div class="sectiontitle">Constants</div>
116
+ <table border='0' cellpadding='5'>
117
+
118
+ <tr valign='top'>
119
+ <td class="attr-name">STEP</td>
120
+ <td>=</td>
121
+ <td class="attr-value">BigDecimal.new(&quot;10&quot;)**BigDecimal.new(&quot;30&quot;)</td>
122
+ </tr>
123
+
124
+ <tr valign='top'>
125
+ <td>&nbsp;</td>
126
+ <td colspan="2" class="attr-desc"></td>
127
+ </tr>
128
+
129
+
130
+ </table>
131
+
132
+
133
+
134
+
135
+
136
+
137
+ <!-- Methods -->
138
+
139
+ <div class="sectiontitle">Class Public methods</div>
140
+
141
+ <div class="method">
142
+ <div class="title method-title" id="method-c-NANO_to_raw">
143
+
144
+ <b>NANO_to_raw</b>(nano)
145
+
146
+ <a href="../../classes/Nanook/Util.html#method-c-NANO_to_raw" name="method-c-NANO_to_raw" class="permalink">Link</a>
147
+ </div>
148
+
149
+
150
+ <div class="description">
151
+
152
+ </div>
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+ <div class="sourcecode">
162
+
163
+ <p class="source-link">
164
+ Source:
165
+ <a href="javascript:toggleSource('method-c-NANO_to_raw_source')" id="l_method-c-NANO_to_raw_source">show</a>
166
+
167
+ </p>
168
+ <div id="method-c-NANO_to_raw_source" class="dyn-source">
169
+ <pre><span class="ruby-comment"># File lib/nanook/util.rb, line 8</span>
170
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-constant">NANO_to_raw</span>(<span class="ruby-identifier ruby-title">nano</span>)
171
+ (<span class="ruby-constant">BigDecimal</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">nano</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-operator">*</span> <span class="ruby-constant">STEP</span>).<span class="ruby-identifier">to_i</span>
172
+ <span class="ruby-keyword">end</span></pre>
173
+ </div>
174
+ </div>
175
+
176
+ </div>
177
+
178
+ <div class="method">
179
+ <div class="title method-title" id="method-c-coerce_empty_string_to_type">
180
+
181
+ <b>coerce_empty_string_to_type</b>(response, type)
182
+
183
+ <a href="../../classes/Nanook/Util.html#method-c-coerce_empty_string_to_type" name="method-c-coerce_empty_string_to_type" class="permalink">Link</a>
184
+ </div>
185
+
186
+
187
+ <div class="description">
188
+
189
+ </div>
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+ <div class="sourcecode">
199
+
200
+ <p class="source-link">
201
+ Source:
202
+ <a href="javascript:toggleSource('method-c-coerce_empty_string_to_type_source')" id="l_method-c-coerce_empty_string_to_type_source">show</a>
203
+
204
+ </p>
205
+ <div id="method-c-coerce_empty_string_to_type_source" class="dyn-source">
206
+ <pre><span class="ruby-comment"># File lib/nanook/util.rb, line 16</span>
207
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">coerce_empty_string_to_type</span>(<span class="ruby-identifier">response</span>, <span class="ruby-identifier">type</span>)
208
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">response</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;&quot;</span>
209
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">new</span>
210
+ <span class="ruby-keyword">end</span>
211
+
212
+ <span class="ruby-identifier">response</span>
213
+ <span class="ruby-keyword">end</span></pre>
214
+ </div>
215
+ </div>
216
+
217
+ </div>
218
+
219
+ <div class="method">
220
+ <div class="title method-title" id="method-c-raw_to_NANO">
221
+
222
+ <b>raw_to_NANO</b>(raw)
223
+
224
+ <a href="../../classes/Nanook/Util.html#method-c-raw_to_NANO" name="method-c-raw_to_NANO" class="permalink">Link</a>
225
+ </div>
226
+
227
+
228
+ <div class="description">
229
+
230
+ </div>
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+ <div class="sourcecode">
240
+
241
+ <p class="source-link">
242
+ Source:
243
+ <a href="javascript:toggleSource('method-c-raw_to_NANO_source')" id="l_method-c-raw_to_NANO_source">show</a>
244
+
245
+ </p>
246
+ <div id="method-c-raw_to_NANO_source" class="dyn-source">
247
+ <pre><span class="ruby-comment"># File lib/nanook/util.rb, line 12</span>
248
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">raw_to_NANO</span>(<span class="ruby-identifier">raw</span>)
249
+ <span class="ruby-identifier">raw</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-constant">STEP</span>
250
+ <span class="ruby-keyword">end</span></pre>
251
+ </div>
252
+ </div>
253
+
254
+ </div>
255
+
256
+
257
+
258
+
259
+
260
+ </div>
261
+
262
+ </div>
263
+ </body>
264
+ </html>