libastag 0.0.1

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 (96) hide show
  1. data/CHANGES +7 -0
  2. data/MIT-LICENSE +19 -0
  3. data/README +65 -0
  4. data/Rakefile +276 -0
  5. data/TODO +7 -0
  6. data/doc/classes/Helpers/REXML/Attributes.html +179 -0
  7. data/doc/classes/Helpers/REXML.html +115 -0
  8. data/doc/classes/Helpers.html +181 -0
  9. data/doc/classes/Libastag/Rabbit.html +462 -0
  10. data/doc/classes/Libastag/RabitEar.html +120 -0
  11. data/doc/classes/Libastag/RabitLed.html +120 -0
  12. data/doc/classes/Libastag.html +141 -0
  13. data/doc/classes/Request/Action.html +213 -0
  14. data/doc/classes/Request/Base/Event.html +226 -0
  15. data/doc/classes/Request/Base/EventCollection.html +246 -0
  16. data/doc/classes/Request/Base.html +134 -0
  17. data/doc/classes/Request/GET_EARS_POSITION.html +151 -0
  18. data/doc/classes/Request/Query.html +244 -0
  19. data/doc/classes/Request/SetEarsPosition.html +213 -0
  20. data/doc/classes/Request/TtsMessage.html +235 -0
  21. data/doc/classes/Request.html +414 -0
  22. data/doc/classes/Response/AbuseSending.html +165 -0
  23. data/doc/classes/Response/Base/BadServerRsp.html +163 -0
  24. data/doc/classes/Response/Base/GoodServerRsp.html +161 -0
  25. data/doc/classes/Response/Base/ServerRsp.html +347 -0
  26. data/doc/classes/Response/Base.html +162 -0
  27. data/doc/classes/Response/Blacklist.html +165 -0
  28. data/doc/classes/Response/ChorNotSend.html +166 -0
  29. data/doc/classes/Response/ChorSend.html +165 -0
  30. data/doc/classes/Response/CommandSend.html +168 -0
  31. data/doc/classes/Response/EarPositionNotSend.html +165 -0
  32. data/doc/classes/Response/EarPositionSend.html +165 -0
  33. data/doc/classes/Response/EmptyServerRsp.html +161 -0
  34. data/doc/classes/Response/LangListUser.html +166 -0
  35. data/doc/classes/Response/LinkPreview.html +165 -0
  36. data/doc/classes/Response/ListFriend.html +165 -0
  37. data/doc/classes/Response/ListReceivedMsg.html +165 -0
  38. data/doc/classes/Response/MessageNotSend.html +165 -0
  39. data/doc/classes/Response/MessageSend.html +165 -0
  40. data/doc/classes/Response/NabCastNotSend.html +169 -0
  41. data/doc/classes/Response/NabCastSend.html +165 -0
  42. data/doc/classes/Response/NoCorrectParameters.html +165 -0
  43. data/doc/classes/Response/NoGoodTokenOrSerial.html +165 -0
  44. data/doc/classes/Response/NotV2Rabbit.html +165 -0
  45. data/doc/classes/Response/PositionEar.html +166 -0
  46. data/doc/classes/Response/ProtocolExcepion.html +164 -0
  47. data/doc/classes/Response/RabbitName.html +164 -0
  48. data/doc/classes/Response/RabbitSleep.html +164 -0
  49. data/doc/classes/Response/RabbitVersion.html +164 -0
  50. data/doc/classes/Response/Signature.html +164 -0
  51. data/doc/classes/Response/Timezone.html +164 -0
  52. data/doc/classes/Response/TtsNotSend.html +168 -0
  53. data/doc/classes/Response/TtsSend.html +165 -0
  54. data/doc/classes/Response/VoiceListTts.html +165 -0
  55. data/doc/classes/Response/WebRadioNotSend.html +165 -0
  56. data/doc/classes/Response/WebRadioSend.html +165 -0
  57. data/doc/classes/Response.html +337 -0
  58. data/doc/classes/VioletAPI.html +118 -0
  59. data/doc/created.rid +1 -0
  60. data/doc/dot/f_0.dot +14 -0
  61. data/doc/dot/f_0.png +0 -0
  62. data/doc/dot/f_4.dot +57 -0
  63. data/doc/dot/f_4.png +0 -0
  64. data/doc/dot/f_5.dot +489 -0
  65. data/doc/dot/f_5.png +0 -0
  66. data/doc/dot/f_6.dot +55 -0
  67. data/doc/dot/f_6.png +0 -0
  68. data/doc/dot/f_7.dot +30 -0
  69. data/doc/dot/f_7.png +0 -0
  70. data/doc/dot/f_8.dot +142 -0
  71. data/doc/dot/f_8.png +0 -0
  72. data/doc/files/CHANGES.html +126 -0
  73. data/doc/files/MIT-LICENSE.html +134 -0
  74. data/doc/files/README.html +192 -0
  75. data/doc/files/TODO.html +126 -0
  76. data/doc/files/lib/libastag_rb.html +116 -0
  77. data/doc/files/lib/violet/helpers_rb.html +123 -0
  78. data/doc/files/lib/violet/request_rb.html +133 -0
  79. data/doc/files/lib/violet/response_rb.html +220 -0
  80. data/doc/files/lib/violet/violetapi_rb.html +114 -0
  81. data/doc/fr_class_index.html +79 -0
  82. data/doc/fr_file_index.html +35 -0
  83. data/doc/fr_method_index.html +56 -0
  84. data/doc/index.html +24 -0
  85. data/doc/rdoc-style.css +208 -0
  86. data/lib/libastag.rb +116 -0
  87. data/lib/violet/helpers.rb +48 -0
  88. data/lib/violet/request.rb +301 -0
  89. data/lib/violet/response.rb +412 -0
  90. data/lib/violet/violetapi.rb +14 -0
  91. data/test/fake_violet_srv.rb +94 -0
  92. data/test/test_helpers.rb +31 -0
  93. data/test/test_request.rb +20 -0
  94. data/test/test_response.rb +295 -0
  95. data/test/test_send.rb +137 -0
  96. metadata +264 -0
data/CHANGES ADDED
@@ -0,0 +1,7 @@
1
+ ==v0.0.1
2
+
3
+ - Response module is working
4
+ - test/doc for Response
5
+
6
+ - Base of Request module is working (Query class, sending message, actions)
7
+ - test/doc for Action and Request::Base
data/MIT-LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2007 Perrin Alexandre
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,65 @@
1
+ =libastag --- a Nabastag communication library for Ruby
2
+ [Author]
3
+ Perrin Alexandre <kaworu@kaworu.ch>
4
+
5
+
6
+ ==About
7
+
8
+ libastag is a full featured library for the Nabastag API (see http://api.nabaztag.com/docs/home.html).
9
+ It provide also a minimal fake HTTP Violet Server based on WEBrick for testing purpose.
10
+
11
+ Main goals are :
12
+ - complete Rdoc documentation
13
+ - Unit testing
14
+ - Easy to use
15
+
16
+
17
+
18
+ ==About Nabastag
19
+
20
+ The Nabaztag is a small electronic rabbit with lights, motorised ears, and speech.
21
+
22
+ http://www.nabaztag.com
23
+
24
+
25
+
26
+ ==Download
27
+
28
+ You can found the latest version of libastag at :
29
+ - http://rubyforge.org/frs/?group_id=4947
30
+
31
+
32
+
33
+ == Installation
34
+
35
+ =Gem Instalation
36
+
37
+ to install libastag's gem :
38
+ gem install --remote libastag
39
+
40
+
41
+
42
+ ==Online Documentation
43
+
44
+ - libastag Documentation Homepage : http://libastag.rubyforge.org
45
+ - libastag Project Page : http://rubyforge.org/projects/libastag
46
+
47
+
48
+
49
+ ==Irb Examples
50
+ TODO
51
+
52
+
53
+
54
+ ==Other Nabastag related Ruby projects
55
+
56
+ - Nabaztag : http://rubyforge.org/projects/nabaztag
57
+
58
+
59
+
60
+ ==Copying
61
+
62
+ Copyright (c) 2007 Perrin Alexandre
63
+
64
+ You may use, copy and redistribute this library under the terms of the MIT licence (see MIT-LICENSE file).
65
+
data/Rakefile ADDED
@@ -0,0 +1,276 @@
1
+ #
2
+ # libastag's Rakefile
3
+ #
4
+
5
+ require 'rake/rdoctask'
6
+ require 'rake/testtask'
7
+ require 'rake/clean'
8
+ require 'rake/gempackagetask'
9
+
10
+
11
+
12
+ task :default => [:stats]
13
+
14
+
15
+ # perso infos
16
+ MY_NAME = "Alexandre Perrin"
17
+ MY_EMAIL = "makoto.kaworu@gmail.com"
18
+
19
+
20
+ # Project infos
21
+ PROJECT = "libastag"
22
+ PROJECT_SUMMARY = "A library for sending commands to Nabastag(/tag) (see http://www.nabaztag.com)"
23
+ PROJECT_DESC = <<-EOF
24
+ libastag is a full featured library for the Nabastag API (see http://api.nabaztag.com/docs/home.html).
25
+ It provide also a minimal fake Violet HTTP Server written with WEBrick for testing purpose.
26
+ Main goals are :
27
+ - complete Rdoc documentations
28
+ - Unit testing
29
+ - Easy to use
30
+ EOF
31
+
32
+ require File.join( File.dirname(__FILE__), 'lib', "#{PROJECT}.rb" )
33
+ PROJECT_VERSION = eval "#{PROJECT.capitalize}::VERSION"
34
+
35
+
36
+ # rubyforge infos
37
+ RUBYFORGE_USER = "kaworu"
38
+ UNIX_NAME = "libastag"
39
+
40
+
41
+ # Rdoc
42
+ RDOC_DIR = "doc"
43
+ RDOC_OPTIONS = [
44
+ "--title", "#{PROJECT} API documentation",
45
+ "--main", "README",
46
+ "--charset", "utf-8",
47
+ "--diagram",
48
+ "--line-number",
49
+ "--inline-source"
50
+ ]
51
+
52
+
53
+ # files
54
+ LIB_FILES = Dir["lib/**/*.rb"]
55
+ TEST_FILES = Dir["test/**/*.rb"]
56
+
57
+ RDOC_FILES = %w[ README MIT-LICENSE TODO CHANGES ] + LIB_FILES
58
+ DIST_FILES = %w[ Rakefile ] + LIB_FILES + TEST_FILES + RDOC_FILES
59
+
60
+
61
+
62
+ #
63
+ # RDoc
64
+ #
65
+ Rake::RDocTask.new do |rd|
66
+ rd.main = RDOC_FILES.first
67
+ rd.rdoc_dir = RDOC_DIR
68
+ rd.options = RDOC_OPTIONS
69
+ rd.rdoc_files.include(*RDOC_FILES)
70
+ end
71
+
72
+
73
+
74
+ #
75
+ # Tests
76
+ #
77
+ Rake::TestTask.new do |t|
78
+ t.verbose = true
79
+ t.warning = true
80
+ end
81
+
82
+
83
+
84
+ #
85
+ # Cleaning
86
+ #
87
+ CLOBBER.include 'doc', 'pkg'
88
+ CLEAN.include 'doc', 'pkg', 'test/**/*.tmp'
89
+
90
+
91
+
92
+ #
93
+ # Pkg
94
+ #
95
+ gem_spec = Gem::Specification.new do |s|
96
+ s.author = MY_NAME
97
+ s.email = MY_EMAIL
98
+ s.homepage = "http://#{UNIX_NAME}.rubyforge.org"
99
+
100
+ s.name = PROJECT
101
+ s.summary = PROJECT_SUMMARY
102
+ s.description = PROJECT_DESC
103
+
104
+ s.has_rdoc = true
105
+ s.rdoc_options = RDOC_OPTIONS
106
+ s.extra_rdoc_files = RDOC_FILES + Dir["#{RDOC_DIR}/**/*"]
107
+
108
+ s.test_files = TEST_FILES
109
+ s.files = DIST_FILES
110
+ s.version = PROJECT_VERSION
111
+ s.rubyforge_project = UNIX_NAME
112
+ end
113
+
114
+ Rake::GemPackageTask.new(gem_spec) do |pkg|
115
+ pkg.need_zip = true
116
+ pkg.need_tar = true
117
+ end
118
+
119
+
120
+
121
+ #
122
+ # stats
123
+ #
124
+ # ScriptLines class is code from Oreilly's "Ruby Cookbook" (rewritted a bit)
125
+ #
126
+ module Stats
127
+ # A ScriptLines instance analyses a Ruby script and maintains
128
+ # counters for the total number of lines, lines of code, etc.
129
+ class ScriptLines
130
+
131
+ attr_reader :name
132
+ attr_accessor :bytes, :lines, :lines_of_code, :lines_of_comments
133
+
134
+ LINE_FORMAT = '%8s %8s %8s %8s %s'
135
+
136
+
137
+ def ScriptLines.headline
138
+ LINE_FORMAT % %w[ BYTES LINES LOC COMMENT FILE ]
139
+ end
140
+
141
+ # The 'name' argument is usually a filename
142
+ def initialize(name)
143
+ @name = name
144
+ @bytes, @lines, @lines_of_code, @lines_of_comments = 0, 0, 0, 0
145
+ end
146
+
147
+ # Iterates over all the lines in io (io might be a file or a string), analyses them and appropriately increases
148
+ # the counter attributes.
149
+ def read(io)
150
+ in_multiline_comment = false
151
+
152
+ io.each do |line|
153
+ @lines += 1
154
+ @bytes += line.size
155
+
156
+ case line
157
+ when /^=(begin|end)/ # multi line comment
158
+ @lines_of_comments += 1
159
+ in_multiline_comment = ($1 == 'begin')
160
+
161
+ when /^\s*#/ # Comment line
162
+ @lines_of_comments += 1
163
+
164
+ when /^\s*$/ # empty/whitespace only line
165
+ # do nothin' :)
166
+
167
+ else
168
+ if in_multiline_comment then @lines_of_comments += 1 else @lines_of_code += 1 end
169
+ end
170
+ end
171
+ end
172
+
173
+ # Get a new ScriptLines instance whose counters hold the
174
+ # sum of self and other.
175
+ def +(other)
176
+ sum = self.dup
177
+ sum.bytes += other.bytes
178
+ sum.lines += other.lines
179
+ sum.lines_of_code += other.lines_of_code
180
+ sum.lines_of_comments += other.lines_of_comments
181
+ sum
182
+ end
183
+
184
+ # Get a formatted string containing all counter numbers and the
185
+ # name of this instance.
186
+ def to_s
187
+ LINE_FORMAT % [@bytes, @lines, @lines_of_code, @lines_of_comments, @name]
188
+ end
189
+ end
190
+
191
+ end
192
+
193
+
194
+ desc "display somes stats (# of lines, # lines of comment/code etc.) of this project"
195
+ task 'stats' do
196
+
197
+ def stats_display name, files
198
+ include Stats
199
+ puts "\nStats (#{name})"
200
+ puts ScriptLines.headline
201
+ sum = ScriptLines.new("TOTAL (#{files.size} file(s))")
202
+
203
+ files.each do |f|
204
+ sl = ScriptLines.new f
205
+ sl.read File.read(f)
206
+ puts sl
207
+ sum += sl
208
+ end
209
+ puts sum
210
+ sum
211
+ end
212
+
213
+ libstats = stats_display 'lib files', LIB_FILES
214
+ teststats = stats_display 'test files', TEST_FILES
215
+
216
+ puts
217
+ puts "Ratio (test / code) = %.2f" % (teststats.lines_of_code.to_f / libstats.lines_of_code)
218
+ puts "Ratio (comment / code) = %.2f" % (libstats.lines_of_comments.to_f / libstats.lines_of_code)
219
+ end
220
+
221
+
222
+
223
+ #
224
+ # publish
225
+ #
226
+ desc "setup for RubyForge"
227
+ task "rubyforge-setup" do
228
+ unless File.exist?( File.join(ENV['HOME'], '.rubyforge') )
229
+ puts <<-EOF
230
+ rubyforge will ask you to edit its config file now.
231
+ Please set the 'username' and 'password' entries to your RubyForge username/password !
232
+ press ENTER to continue.
233
+ EOF
234
+ STDIN.gets
235
+ sh "rubyforge setup", :verbose => true
236
+ end
237
+ end
238
+
239
+ desc "Connection to RubyForge's server"
240
+ task "rubyforge-login" => %w[ rubyforge-setup ] do
241
+ sh "rubyforge login", :verbose => true
242
+ end
243
+
244
+
245
+ desc "Upload documentation to RubyForge"
246
+ task "publish-doc" => %w[ rdoc ] do
247
+ rubyforge_path = "/var/www/gforge-projects/#{UNIX_NAME}/"
248
+ sh "scp -r #{RDOC_DIR}/* '#{RUBYFORGE_USER}@rubyforge.org:#{rubyforge_path}'", :verbose => true
249
+ end
250
+
251
+ desc "Upload package to RubyForge"
252
+ task "publish-packages" => %w[ package rubyforge-login ] do
253
+ cd "pkg" do
254
+ %w[ gem tgz zip ].each do |pkgtype|
255
+ sh "rubyforge add_release #{UNIX_NAME} #{UNIX_NAME} #{PROJECT_VERSION} #{UNIX_NAME}-#{PROJECT_VERSION}.#{pkgtype}"
256
+ end
257
+ end
258
+ end
259
+
260
+ desc "Run tests, generate RDoc and create packages."
261
+ task "pre-release" => %w[ clobber clean ] do
262
+ puts "Preparing release of #{PROJECT} v#{PROJECT_VERSION}"
263
+ Rake::Task["test"].invoke
264
+ Rake::Task["rdoc"].invoke
265
+ Rake::Task["package"].invoke
266
+ end
267
+
268
+ desc "Publish a new release of #{PROJECT}"
269
+ task "publish" => %w[ pre-release ] do
270
+ puts "Uploading doc..."
271
+ Rake::Task["publish-doc"].invoke
272
+ puts "Uploading packages..."
273
+ Rake::Task["publish-packages"].invoke
274
+ puts "release done !"
275
+ end
276
+
data/TODO ADDED
@@ -0,0 +1,7 @@
1
+ - Complete Request module
2
+ - move EvenCollection out of Base
3
+ - Complete Request module doc/test
4
+
5
+ - Write doc for Helpers module
6
+ - Write doc for VioletAPI module
7
+
@@ -0,0 +1,179 @@
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>Class: Helpers::REXML::Attributes</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>Class</strong></td>
53
+ <td class="class-name-in-header">Helpers::REXML::Attributes</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../files/lib/violet/helpers_rb.html">
59
+ lib/violet/helpers.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+ <div id="diagram">
81
+ <map id="map" name="map">
82
+ <area shape="rect" coords="53,85,128,133" href="Attributes.html" alt="Attributes" />
83
+ <area shape="rect" coords="43,51,165,144" href="../REXML.html" alt="REXML" />
84
+ <area shape="rect" coords="16,16,176,155" href="../../Helpers.html" alt="Helpers" />
85
+ </map>
86
+ <img src="../../../dot/f_6.png" usemap="#map" border="0" alt="dot/f_6.png">
87
+ </div>
88
+
89
+ <div id="description">
90
+ <p>
91
+ <a href="Attributes.html#M000002">REXML::Attributes#to_hash</a> seems to be
92
+ broken.
93
+ </p>
94
+
95
+ </div>
96
+
97
+
98
+ </div>
99
+
100
+ <div id="method-list">
101
+ <h3 class="section-bar">Methods</h3>
102
+
103
+ <div class="name-list">
104
+ <a href="#M000002">to_hash</a>&nbsp;&nbsp;
105
+ </div>
106
+ </div>
107
+
108
+ </div>
109
+
110
+
111
+ <!-- if includes -->
112
+
113
+ <div id="section">
114
+
115
+
116
+
117
+ <div id="aliases-list">
118
+ <h3 class="section-bar">External Aliases</h3>
119
+
120
+ <div class="name-list">
121
+ <table summary="aliases">
122
+ <tr class="top-aligned-row context-row">
123
+ <td class="context-item-name">to_hash</td>
124
+ <td>-&gt;</td>
125
+ <td class="context-item-value">to_hash_old</td>
126
+ </tr>
127
+ </table>
128
+ </div>
129
+ </div>
130
+
131
+
132
+
133
+
134
+
135
+ <!-- if method_list -->
136
+ <div id="methods">
137
+ <h3 class="section-bar">Public Instance methods</h3>
138
+
139
+ <div id="method-M000002" class="method-detail">
140
+ <a name="M000002"></a>
141
+
142
+ <div class="method-heading">
143
+ <a href="#M000002" class="method-signature">
144
+ <span class="method-name">to_hash</span><span class="method-args">()</span>
145
+ </a>
146
+ </div>
147
+
148
+ <div class="method-description">
149
+ <p>
150
+ convert attributes to an instance of Hash.
151
+ </p>
152
+ <p><a class="source-toggle" href="#"
153
+ onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
154
+ <div class="method-source-code" id="M000002-source">
155
+ <pre>
156
+ <span class="ruby-comment cmt"># File lib/violet/helpers.rb, line 17</span>
157
+ 17: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_hash</span>
158
+ 18: <span class="ruby-identifier">h</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
159
+ 19: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>,<span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_sym</span>] = <span class="ruby-identifier">value</span> }
160
+ 20: <span class="ruby-identifier">h</span>
161
+ 21: <span class="ruby-keyword kw">end</span>
162
+ </pre>
163
+ </div>
164
+ </div>
165
+ </div>
166
+
167
+
168
+ </div>
169
+
170
+
171
+ </div>
172
+
173
+
174
+ <div id="validator-badges">
175
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
176
+ </div>
177
+
178
+ </body>
179
+ </html>
@@ -0,0 +1,115 @@
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: Helpers::REXML</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">Helpers::REXML</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ </td>
59
+ </tr>
60
+
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+ <div id="diagram">
71
+ <map id="map" name="map">
72
+ <area shape="rect" coords="53,85,128,133" href="REXML/Attributes.html" alt="Attributes" />
73
+ <area shape="rect" coords="43,51,165,144" href="REXML.html" alt="REXML" />
74
+ <area shape="rect" coords="16,16,176,155" href="../Helpers.html" alt="Helpers" />
75
+ </map>
76
+ <img src="../../dot/f_6.png" usemap="#map" border="0" alt="dot/f_6.png">
77
+ </div>
78
+
79
+
80
+
81
+ </div>
82
+
83
+
84
+ </div>
85
+
86
+
87
+ <!-- if includes -->
88
+
89
+ <div id="section">
90
+
91
+ <div id="class-list">
92
+ <h3 class="section-bar">Classes and Modules</h3>
93
+
94
+ Class <a href="REXML/Attributes.html" class="link">Helpers::REXML::Attributes</a><br />
95
+
96
+ </div>
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+ <!-- if method_list -->
105
+
106
+
107
+ </div>
108
+
109
+
110
+ <div id="validator-badges">
111
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
112
+ </div>
113
+
114
+ </body>
115
+ </html>