hash_magic 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +78 -0
- data/doc/classes/Hash.html +177 -0
- data/doc/classes/Hash.src/M000012.html +18 -0
- data/doc/classes/Hash.src/M000013.html +18 -0
- data/doc/classes/OrderedHash.html +208 -0
- data/doc/classes/OrderedHash.src/M000014.html +18 -0
- data/doc/classes/OrderedHash.src/M000015.html +19 -0
- data/doc/classes/OrderedHash.src/M000016.html +18 -0
- data/doc/classes/OrderedHash.src/M000017.html +18 -0
- data/doc/classes/OrderedHash.src/M000018.html +18 -0
- data/doc/classes/SlashedHash.html +373 -0
- data/doc/classes/SlashedHash.src/M000001.html +20 -0
- data/doc/classes/SlashedHash.src/M000002.html +25 -0
- data/doc/classes/SlashedHash.src/M000003.html +25 -0
- data/doc/classes/SlashedHash.src/M000004.html +21 -0
- data/doc/classes/SlashedHash.src/M000005.html +18 -0
- data/doc/classes/SlashedHash.src/M000006.html +18 -0
- data/doc/classes/SlashedHash.src/M000007.html +18 -0
- data/doc/classes/SlashedHash.src/M000008.html +18 -0
- data/doc/classes/SlashedHash.src/M000009.html +18 -0
- data/doc/classes/SlashedHash.src/M000010.html +18 -0
- data/doc/classes/SlashedHash.src/M000011.html +21 -0
- data/doc/created.rid +1 -0
- data/doc/files/lib/hash_magic_rb.html +126 -0
- data/doc/fr_class_index.html +29 -0
- data/doc/fr_file_index.html +27 -0
- data/doc/fr_method_index.html +44 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/hash_magic.rb +359 -0
- metadata +88 -0
data/Rakefile
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/testtask'
|
4
|
+
require 'rake/rdoctask'
|
5
|
+
require 'rake/gempackagetask'
|
6
|
+
require 'rake/contrib/rubyforgepublisher'
|
7
|
+
|
8
|
+
PKG_NAME = 'hash_magic'
|
9
|
+
PKG_VERSION = "0.0.1"
|
10
|
+
|
11
|
+
PKG_FILES = FileList[
|
12
|
+
"lib/**/*", "rspec/**/*", "[A-Z]*", "Rakefile", "doc/**/*"
|
13
|
+
]
|
14
|
+
|
15
|
+
desc "Default Task"
|
16
|
+
task :default => [ :test ] do
|
17
|
+
# Run the unit tests
|
18
|
+
desc "Run all rspec tests (rake task not yet implemented!)"
|
19
|
+
end
|
20
|
+
|
21
|
+
# Make a console, useful when working on tests
|
22
|
+
desc "Generate a test console"
|
23
|
+
task :console do
|
24
|
+
verbose( false ) { sh "irb -I lib/ -r '#{PKG_NAME}'" }
|
25
|
+
end
|
26
|
+
|
27
|
+
# Genereate the RDoc documentation
|
28
|
+
desc "Create documentation"
|
29
|
+
Rake::RDocTask.new("doc") { |rdoc|
|
30
|
+
rdoc.title = "Hash Magic"
|
31
|
+
rdoc.rdoc_dir = 'doc'
|
32
|
+
# rdoc.rdoc_files.include('README')
|
33
|
+
# rdoc.rdoc_files.include('LICENSE')
|
34
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
35
|
+
}
|
36
|
+
|
37
|
+
# Generate the package
|
38
|
+
spec = Gem::Specification.new do |s|
|
39
|
+
#### Basic information.
|
40
|
+
s.name = PKG_NAME
|
41
|
+
s.version = PKG_VERSION
|
42
|
+
s.platform = Gem::Platform::RUBY
|
43
|
+
s.description = s.summary = "Adds Hash#ordered and Hash#slashed to Hash, which flavor a hash to behave in certain more humanly manners."
|
44
|
+
|
45
|
+
#### Which files are to be included in this gem? Everything! (Except CVS directories.)
|
46
|
+
s.files = PKG_FILES
|
47
|
+
|
48
|
+
#### Load-time details: library and application (you will need one or both).
|
49
|
+
s.require_path = 'lib'
|
50
|
+
|
51
|
+
#### Documentation and testing.
|
52
|
+
s.has_rdoc = true
|
53
|
+
# s.extra_rdoc_files = ["README", "LICENSE"]
|
54
|
+
|
55
|
+
#### Author and project details.
|
56
|
+
s.author = "Daniel Parker"
|
57
|
+
s.email = "gems@behindlogic.com"
|
58
|
+
s.homepage = "http://hash_magic.rubyforge.org"
|
59
|
+
s.rubyforge_project = 'hash-magic'
|
60
|
+
end
|
61
|
+
|
62
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
63
|
+
pkg.need_zip = false
|
64
|
+
pkg.need_tar = false
|
65
|
+
end
|
66
|
+
|
67
|
+
desc "Report code statistics (KLOCs, etc) from the application"
|
68
|
+
task :stats do
|
69
|
+
require 'code_statistics'
|
70
|
+
CodeStatistics.new(
|
71
|
+
["Library", "lib"]
|
72
|
+
).to_s
|
73
|
+
end
|
74
|
+
|
75
|
+
desc "Publish new documentation"
|
76
|
+
task :publish => [:doc] do
|
77
|
+
`scp -r doc/* dcparker@rubyforge.org:/var/www/gforge-projects/hash-magic`
|
78
|
+
end
|
@@ -0,0 +1,177 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
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: Hash</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
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">Hash</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/hash_magic_rb.html">
|
59
|
+
lib/hash_magic.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
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
The aim of this gem:
|
84
|
+
</p>
|
85
|
+
<ol>
|
86
|
+
<li>Don‘t extend <a href="Hash.html">Hash</a>
|
87
|
+
|
88
|
+
</li>
|
89
|
+
<li>Provide <a href="SlashedHash.html">SlashedHash</a>
|
90
|
+
|
91
|
+
</li>
|
92
|
+
<li>Provide <a href="OrderedHash.html">OrderedHash</a>
|
93
|
+
|
94
|
+
</li>
|
95
|
+
<li>Make a <a href="SlashedHash.html">SlashedHash</a> orderable
|
96
|
+
|
97
|
+
</li>
|
98
|
+
<li>Make an <a href="OrderedHash.html">OrderedHash</a> convert correctly to an
|
99
|
+
<a href="Hash.html#M000013">ordered</a> <a
|
100
|
+
href="SlashedHash.html">SlashedHash</a>
|
101
|
+
|
102
|
+
</li>
|
103
|
+
</ol>
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
|
108
|
+
</div>
|
109
|
+
|
110
|
+
<div id="method-list">
|
111
|
+
<h3 class="section-bar">Methods</h3>
|
112
|
+
|
113
|
+
<div class="name-list">
|
114
|
+
<a href="#M000013">ordered</a>
|
115
|
+
<a href="#M000012">slashed</a>
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
|
119
|
+
</div>
|
120
|
+
|
121
|
+
|
122
|
+
<!-- if includes -->
|
123
|
+
|
124
|
+
<div id="section">
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<!-- if method_list -->
|
134
|
+
<div id="methods">
|
135
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
136
|
+
|
137
|
+
<div id="method-M000013" class="method-detail">
|
138
|
+
<a name="M000013"></a>
|
139
|
+
|
140
|
+
<div class="method-heading">
|
141
|
+
<a href="Hash.src/M000013.html" target="Code" class="method-signature"
|
142
|
+
onclick="popupCode('Hash.src/M000013.html');return false;">
|
143
|
+
<span class="method-name">ordered</span><span class="method-args">(*keys_in_order)</span>
|
144
|
+
</a>
|
145
|
+
</div>
|
146
|
+
|
147
|
+
<div class="method-description">
|
148
|
+
</div>
|
149
|
+
</div>
|
150
|
+
|
151
|
+
<div id="method-M000012" class="method-detail">
|
152
|
+
<a name="M000012"></a>
|
153
|
+
|
154
|
+
<div class="method-heading">
|
155
|
+
<a href="Hash.src/M000012.html" target="Code" class="method-signature"
|
156
|
+
onclick="popupCode('Hash.src/M000012.html');return false;">
|
157
|
+
<span class="method-name">slashed</span><span class="method-args">()</span>
|
158
|
+
</a>
|
159
|
+
</div>
|
160
|
+
|
161
|
+
<div class="method-description">
|
162
|
+
</div>
|
163
|
+
</div>
|
164
|
+
|
165
|
+
|
166
|
+
</div>
|
167
|
+
|
168
|
+
|
169
|
+
</div>
|
170
|
+
|
171
|
+
|
172
|
+
<div id="validator-badges">
|
173
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
174
|
+
</div>
|
175
|
+
|
176
|
+
</body>
|
177
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
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>slashed (Hash)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
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/hash_magic.rb, line 9</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">slashed</span>
|
15
|
+
<span class="ruby-constant">SlashedHash</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>)
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
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>ordered (Hash)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
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/hash_magic.rb, line 12</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ordered</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">keys_in_order</span>)
|
15
|
+
<span class="ruby-constant">OrderedHash</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">keys_in_order</span>).<span class="ruby-identifier">update!</span>(<span class="ruby-keyword kw">self</span>)
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,208 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
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: OrderedHash</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
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">OrderedHash</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/hash_magic_rb.html">
|
59
|
+
lib/hash_magic.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
|
+
<a href="Hash.html">
|
69
|
+
Hash
|
70
|
+
</a>
|
71
|
+
</td>
|
72
|
+
</tr>
|
73
|
+
</table>
|
74
|
+
</div>
|
75
|
+
<!-- banner header -->
|
76
|
+
|
77
|
+
<div id="bodyContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="contextContent">
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
</div>
|
86
|
+
|
87
|
+
<div id="method-list">
|
88
|
+
<h3 class="section-bar">Methods</h3>
|
89
|
+
|
90
|
+
<div class="name-list">
|
91
|
+
<a href="#M000015">[]=</a>
|
92
|
+
<a href="#M000016">inspect</a>
|
93
|
+
<a href="#M000017">keys</a>
|
94
|
+
<a href="#M000014">new</a>
|
95
|
+
<a href="#M000018">slashed</a>
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
|
99
|
+
</div>
|
100
|
+
|
101
|
+
|
102
|
+
<!-- if includes -->
|
103
|
+
<div id="includes">
|
104
|
+
<h3 class="section-bar">Included Modules</h3>
|
105
|
+
|
106
|
+
<div id="includes-list">
|
107
|
+
<span class="include-name">StandardHashMethodsInRuby</span>
|
108
|
+
</div>
|
109
|
+
</div>
|
110
|
+
|
111
|
+
<div id="section">
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
<!-- if method_list -->
|
121
|
+
<div id="methods">
|
122
|
+
<h3 class="section-bar">Public Class methods</h3>
|
123
|
+
|
124
|
+
<div id="method-M000014" class="method-detail">
|
125
|
+
<a name="M000014"></a>
|
126
|
+
|
127
|
+
<div class="method-heading">
|
128
|
+
<a href="OrderedHash.src/M000014.html" target="Code" class="method-signature"
|
129
|
+
onclick="popupCode('OrderedHash.src/M000014.html');return false;">
|
130
|
+
<span class="method-name">new</span><span class="method-args">(*args)</span>
|
131
|
+
</a>
|
132
|
+
</div>
|
133
|
+
|
134
|
+
<div class="method-description">
|
135
|
+
</div>
|
136
|
+
</div>
|
137
|
+
|
138
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
139
|
+
|
140
|
+
<div id="method-M000015" class="method-detail">
|
141
|
+
<a name="M000015"></a>
|
142
|
+
|
143
|
+
<div class="method-heading">
|
144
|
+
<a href="OrderedHash.src/M000015.html" target="Code" class="method-signature"
|
145
|
+
onclick="popupCode('OrderedHash.src/M000015.html');return false;">
|
146
|
+
<span class="method-name">[]=</span><span class="method-args">(key,value)</span>
|
147
|
+
</a>
|
148
|
+
</div>
|
149
|
+
|
150
|
+
<div class="method-description">
|
151
|
+
</div>
|
152
|
+
</div>
|
153
|
+
|
154
|
+
<div id="method-M000016" class="method-detail">
|
155
|
+
<a name="M000016"></a>
|
156
|
+
|
157
|
+
<div class="method-heading">
|
158
|
+
<a href="OrderedHash.src/M000016.html" target="Code" class="method-signature"
|
159
|
+
onclick="popupCode('OrderedHash.src/M000016.html');return false;">
|
160
|
+
<span class="method-name">inspect</span><span class="method-args">()</span>
|
161
|
+
</a>
|
162
|
+
</div>
|
163
|
+
|
164
|
+
<div class="method-description">
|
165
|
+
</div>
|
166
|
+
</div>
|
167
|
+
|
168
|
+
<div id="method-M000017" class="method-detail">
|
169
|
+
<a name="M000017"></a>
|
170
|
+
|
171
|
+
<div class="method-heading">
|
172
|
+
<a href="OrderedHash.src/M000017.html" target="Code" class="method-signature"
|
173
|
+
onclick="popupCode('OrderedHash.src/M000017.html');return false;">
|
174
|
+
<span class="method-name">keys</span><span class="method-args">()</span>
|
175
|
+
</a>
|
176
|
+
</div>
|
177
|
+
|
178
|
+
<div class="method-description">
|
179
|
+
</div>
|
180
|
+
</div>
|
181
|
+
|
182
|
+
<div id="method-M000018" class="method-detail">
|
183
|
+
<a name="M000018"></a>
|
184
|
+
|
185
|
+
<div class="method-heading">
|
186
|
+
<a href="OrderedHash.src/M000018.html" target="Code" class="method-signature"
|
187
|
+
onclick="popupCode('OrderedHash.src/M000018.html');return false;">
|
188
|
+
<span class="method-name">slashed</span><span class="method-args">()</span>
|
189
|
+
</a>
|
190
|
+
</div>
|
191
|
+
|
192
|
+
<div class="method-description">
|
193
|
+
</div>
|
194
|
+
</div>
|
195
|
+
|
196
|
+
|
197
|
+
</div>
|
198
|
+
|
199
|
+
|
200
|
+
</div>
|
201
|
+
|
202
|
+
|
203
|
+
<div id="validator-badges">
|
204
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
205
|
+
</div>
|
206
|
+
|
207
|
+
</body>
|
208
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
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 (OrderedHash)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
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/hash_magic.rb, line 337</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
15
|
+
<span class="ruby-ivar">@keys_in_order</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">flatten</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
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>[]= (OrderedHash)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
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/hash_magic.rb, line 342</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">key</span>,<span class="ruby-identifier">value</span>)
|
15
|
+
<span class="ruby-ivar">@keys_in_order</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">key</span>
|
16
|
+
<span class="ruby-keyword kw">super</span>
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
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>inspect (OrderedHash)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
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/hash_magic.rb, line 346</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inspect</span>
|
15
|
+
<span class="ruby-keyword kw">super</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-value">1</span>,<span class="ruby-value str">'ordered: '</span>)
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
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>keys (OrderedHash)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
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/hash_magic.rb, line 349</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">keys</span>
|
15
|
+
<span class="ruby-keyword kw">super</span>.<span class="ruby-identifier">sort</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span>,<span class="ruby-identifier">b</span><span class="ruby-operator">|</span> (<span class="ruby-ivar">@keys_in_order</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">a</span>) <span class="ruby-operator">||</span> <span class="ruby-value">-1</span>) <span class="ruby-operator"><=></span> (<span class="ruby-ivar">@keys_in_order</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">b</span>) <span class="ruby-operator">||</span> <span class="ruby-value">-1</span>)}
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
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>slashed (OrderedHash)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
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/hash_magic.rb, line 356</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">slashed</span>
|
15
|
+
<span class="ruby-constant">SlashedHash</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>).<span class="ruby-identifier">ordered!</span>(<span class="ruby-ivar">@keys_in_order</span>)
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|