typed_accessors 0.2 → 0.3.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.
- data/History.txt +8 -0
- data/Manifest.txt +19 -0
- data/PostInstall.txt +4 -0
- data/README.rdoc +69 -0
- data/Rakefile +28 -143
- data/config/website.yml +2 -0
- data/lib/typed_accessors.rb +5 -97
- data/lib/typed_accessors/class.rb +100 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +71 -0
- data/test/test_helper.rb +3 -0
- data/test/test_typed_accessors.rb +11 -0
- data/website/index.html +93 -0
- data/website/index.txt +64 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +159 -0
- data/website/template.html.erb +50 -0
- metadata +75 -36
- data/COPYING +0 -21
- data/README +0 -50
- data/docs/typed_accessors/classes/Class.html +0 -260
- data/docs/typed_accessors/created.rid +0 -1
- data/docs/typed_accessors/files/COPYING.html +0 -133
- data/docs/typed_accessors/files/README.html +0 -156
- data/docs/typed_accessors/files/lib/typed_accessors_rb.html +0 -123
- data/docs/typed_accessors/fr_class_index.html +0 -27
- data/docs/typed_accessors/fr_file_index.html +0 -29
- data/docs/typed_accessors/fr_method_index.html +0 -30
- data/docs/typed_accessors/index.html +0 -24
- data/docs/typed_accessors/rdoc-style.css +0 -208
- data/test/basic_test.rb +0 -118
@@ -1 +0,0 @@
|
|
1
|
-
Sun, 29 Mar 2009 12:38:25 -0400
|
@@ -1,133 +0,0 @@
|
|
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>File: COPYING</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="fileHeader">
|
50
|
-
<h1>COPYING</h1>
|
51
|
-
<table class="header-table">
|
52
|
-
<tr class="top-aligned-row">
|
53
|
-
<td><strong>Path:</strong></td>
|
54
|
-
<td>COPYING
|
55
|
-
</td>
|
56
|
-
</tr>
|
57
|
-
<tr class="top-aligned-row">
|
58
|
-
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Fri Mar 27 16:49:34 -0400 2009</td>
|
60
|
-
</tr>
|
61
|
-
</table>
|
62
|
-
</div>
|
63
|
-
<!-- banner header -->
|
64
|
-
|
65
|
-
<div id="bodyContent">
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
<div id="contextContent">
|
70
|
-
|
71
|
-
<div id="description">
|
72
|
-
<p>
|
73
|
-
The MIT License
|
74
|
-
</p>
|
75
|
-
<p>
|
76
|
-
Copyright (c) 2009 Patrick Ladd, Sean Dague <<a
|
77
|
-
href="http://dague.net">dague.net</a>>
|
78
|
-
</p>
|
79
|
-
<p>
|
80
|
-
Permission is hereby granted, free of charge, to any person obtaining a
|
81
|
-
copy of this software and associated documentation files (the
|
82
|
-
"Software"), to deal in the Software without restriction,
|
83
|
-
including without limitation the rights to use, copy, modify, merge,
|
84
|
-
publish, distribute, sublicense, and/or sell copies of the Software, and to
|
85
|
-
permit persons to whom the Software is furnished to do so, subject to the
|
86
|
-
following conditions:
|
87
|
-
</p>
|
88
|
-
<p>
|
89
|
-
The above copyright notice and this permission notice shall be included in
|
90
|
-
all copies or substantial portions of the Software.
|
91
|
-
</p>
|
92
|
-
<p>
|
93
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
94
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
95
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
96
|
-
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
97
|
-
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
98
|
-
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
99
|
-
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
100
|
-
</p>
|
101
|
-
|
102
|
-
</div>
|
103
|
-
|
104
|
-
|
105
|
-
</div>
|
106
|
-
|
107
|
-
|
108
|
-
</div>
|
109
|
-
|
110
|
-
|
111
|
-
<!-- if includes -->
|
112
|
-
|
113
|
-
<div id="section">
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
<!-- if method_list -->
|
123
|
-
|
124
|
-
|
125
|
-
</div>
|
126
|
-
|
127
|
-
|
128
|
-
<div id="validator-badges">
|
129
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
130
|
-
</div>
|
131
|
-
|
132
|
-
</body>
|
133
|
-
</html>
|
@@ -1,156 +0,0 @@
|
|
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>File: README</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="fileHeader">
|
50
|
-
<h1>README</h1>
|
51
|
-
<table class="header-table">
|
52
|
-
<tr class="top-aligned-row">
|
53
|
-
<td><strong>Path:</strong></td>
|
54
|
-
<td>README
|
55
|
-
</td>
|
56
|
-
</tr>
|
57
|
-
<tr class="top-aligned-row">
|
58
|
-
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Fri Mar 27 16:49:34 -0400 2009</td>
|
60
|
-
</tr>
|
61
|
-
</table>
|
62
|
-
</div>
|
63
|
-
<!-- banner header -->
|
64
|
-
|
65
|
-
<div id="bodyContent">
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
<div id="contextContent">
|
70
|
-
|
71
|
-
<div id="description">
|
72
|
-
<h1>Overview</h1>
|
73
|
-
<p>
|
74
|
-
Typed accessors creates a set of accessors with a predefined typed. Often
|
75
|
-
when dealing with webservices all the data comes back as strings, but you
|
76
|
-
really want to be working with these things as numbers or dates. Manually
|
77
|
-
converting them is duplication, and can be error prone.
|
78
|
-
</p>
|
79
|
-
<h2>Example</h2>
|
80
|
-
<pre>
|
81
|
-
class Foo
|
82
|
-
float_accessor :float
|
83
|
-
date_accessor :date
|
84
|
-
end
|
85
|
-
|
86
|
-
>> f = Foo.new
|
87
|
-
=> #<Foo:0xb7a3dd44>
|
88
|
-
>> f.float = "1.4"
|
89
|
-
=> "1.4"
|
90
|
-
>> f.float
|
91
|
-
=> 1.4
|
92
|
-
>> f.float = "1"
|
93
|
-
=> "1"
|
94
|
-
>> f.float
|
95
|
-
=> 1.0
|
96
|
-
>> f.date = "2009-10-30"
|
97
|
-
=> "2009-10-30"
|
98
|
-
>> f.date
|
99
|
-
=> #<Date: 4910269/2,0,2299161>
|
100
|
-
>> f.date.to_s
|
101
|
-
=> "2009-10-30"
|
102
|
-
</pre>
|
103
|
-
<h2>Installation</h2>
|
104
|
-
<p>
|
105
|
-
First install the gem
|
106
|
-
</p>
|
107
|
-
<pre>
|
108
|
-
gem install typed_accesors
|
109
|
-
</pre>
|
110
|
-
<p>
|
111
|
-
Then include it in your environment
|
112
|
-
</p>
|
113
|
-
<pre>
|
114
|
-
require "typed_accessors"
|
115
|
-
</pre>
|
116
|
-
<h2>Authors</h2>
|
117
|
-
<p>
|
118
|
-
Creator: Pat Ladd Packager: Sean Dague
|
119
|
-
</p>
|
120
|
-
<h2>License</h2>
|
121
|
-
<p>
|
122
|
-
This is released under an MIT license, see COPYING for full details.
|
123
|
-
</p>
|
124
|
-
|
125
|
-
</div>
|
126
|
-
|
127
|
-
|
128
|
-
</div>
|
129
|
-
|
130
|
-
|
131
|
-
</div>
|
132
|
-
|
133
|
-
|
134
|
-
<!-- if includes -->
|
135
|
-
|
136
|
-
<div id="section">
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
<!-- if method_list -->
|
146
|
-
|
147
|
-
|
148
|
-
</div>
|
149
|
-
|
150
|
-
|
151
|
-
<div id="validator-badges">
|
152
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
153
|
-
</div>
|
154
|
-
|
155
|
-
</body>
|
156
|
-
</html>
|
@@ -1,123 +0,0 @@
|
|
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>File: typed_accessors.rb</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="fileHeader">
|
50
|
-
<h1>typed_accessors.rb</h1>
|
51
|
-
<table class="header-table">
|
52
|
-
<tr class="top-aligned-row">
|
53
|
-
<td><strong>Path:</strong></td>
|
54
|
-
<td>lib/typed_accessors.rb
|
55
|
-
</td>
|
56
|
-
</tr>
|
57
|
-
<tr class="top-aligned-row">
|
58
|
-
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Sun Mar 29 12:01:55 -0400 2009</td>
|
60
|
-
</tr>
|
61
|
-
</table>
|
62
|
-
</div>
|
63
|
-
<!-- banner header -->
|
64
|
-
|
65
|
-
<div id="bodyContent">
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
<div id="contextContent">
|
70
|
-
|
71
|
-
<div id="description">
|
72
|
-
<p>
|
73
|
-
Typed accessors works as a Mixin on <a
|
74
|
-
href="../../classes/Class.html">Class</a>. It creates a set of functions
|
75
|
-
that are used in the class definition which eval and create new accessor
|
76
|
-
methods at class eval time (so little performance penalty). For now, this
|
77
|
-
is limitted to built in types, float, int, boolean, and date, though this
|
78
|
-
approach could clearly be expanded.
|
79
|
-
</p>
|
80
|
-
<p>
|
81
|
-
Example of a class definition
|
82
|
-
</p>
|
83
|
-
<pre>
|
84
|
-
class MyClass
|
85
|
-
float_accessor :distance
|
86
|
-
int_accessor :count
|
87
|
-
bool_yn_accessor :onfire
|
88
|
-
date_accessor :day
|
89
|
-
end
|
90
|
-
</pre>
|
91
|
-
|
92
|
-
</div>
|
93
|
-
|
94
|
-
|
95
|
-
</div>
|
96
|
-
|
97
|
-
|
98
|
-
</div>
|
99
|
-
|
100
|
-
|
101
|
-
<!-- if includes -->
|
102
|
-
|
103
|
-
<div id="section">
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
<!-- if method_list -->
|
113
|
-
|
114
|
-
|
115
|
-
</div>
|
116
|
-
|
117
|
-
|
118
|
-
<div id="validator-badges">
|
119
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
120
|
-
</div>
|
121
|
-
|
122
|
-
</body>
|
123
|
-
</html>
|
@@ -1,27 +0,0 @@
|
|
1
|
-
|
2
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
-
<!DOCTYPE html
|
4
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
-
|
7
|
-
<!--
|
8
|
-
|
9
|
-
Classes
|
10
|
-
|
11
|
-
-->
|
12
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
-
<head>
|
14
|
-
<title>Classes</title>
|
15
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
-
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
-
<base target="docwin" />
|
18
|
-
</head>
|
19
|
-
<body>
|
20
|
-
<div id="index">
|
21
|
-
<h1 class="section-bar">Classes</h1>
|
22
|
-
<div id="index-entries">
|
23
|
-
<a href="classes/Class.html">Class</a><br />
|
24
|
-
</div>
|
25
|
-
</div>
|
26
|
-
</body>
|
27
|
-
</html>
|
@@ -1,29 +0,0 @@
|
|
1
|
-
|
2
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
-
<!DOCTYPE html
|
4
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
-
|
7
|
-
<!--
|
8
|
-
|
9
|
-
Files
|
10
|
-
|
11
|
-
-->
|
12
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
-
<head>
|
14
|
-
<title>Files</title>
|
15
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
-
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
-
<base target="docwin" />
|
18
|
-
</head>
|
19
|
-
<body>
|
20
|
-
<div id="index">
|
21
|
-
<h1 class="section-bar">Files</h1>
|
22
|
-
<div id="index-entries">
|
23
|
-
<a href="files/COPYING.html">COPYING</a><br />
|
24
|
-
<a href="files/README.html">README</a><br />
|
25
|
-
<a href="files/lib/typed_accessors_rb.html">lib/typed_accessors.rb</a><br />
|
26
|
-
</div>
|
27
|
-
</div>
|
28
|
-
</body>
|
29
|
-
</html>
|