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.
@@ -0,0 +1,159 @@
1
+ body {
2
+ background-color: #8DBD82;
3
+ font-family: "Georgia", sans-serif;
4
+ font-size: 16px;
5
+ line-height: 1.6em;
6
+ padding: 1.6em 0 0 0;
7
+ color: #333;
8
+ }
9
+ h1, h2, h3, h4, h5, h6 {
10
+ color: #444;
11
+ }
12
+ h1 {
13
+ font-family: sans-serif;
14
+ font-weight: normal;
15
+ font-size: 4em;
16
+ line-height: 0.8em;
17
+ letter-spacing: -0.1ex;
18
+ margin: 5px;
19
+ }
20
+ li {
21
+ padding: 0;
22
+ margin: 0;
23
+ list-style-type: square;
24
+ }
25
+ a {
26
+ color: #5E5AFF;
27
+ background-color: #A1DDB1;
28
+ font-weight: normal;
29
+ text-decoration: underline;
30
+ }
31
+ blockquote {
32
+ font-size: 90%;
33
+ font-style: italic;
34
+ border-left: 1px solid #111;
35
+ padding-left: 1em;
36
+ }
37
+ .caps {
38
+ font-size: 80%;
39
+ }
40
+
41
+ #main {
42
+ width: 55em;
43
+ padding: 0;
44
+ margin: 0 auto;
45
+ }
46
+ .coda {
47
+ text-align: right;
48
+ color: #77f;
49
+ font-size: smaller;
50
+ }
51
+
52
+ table {
53
+ font-size: 90%;
54
+ line-height: 1.4em;
55
+ color: #ff8;
56
+ background-color: #111;
57
+ padding: 2px 10px 2px 10px;
58
+ border-style: dashed;
59
+ }
60
+
61
+ th {
62
+ color: #fff;
63
+ }
64
+
65
+ td {
66
+ padding: 2px 10px 2px 10px;
67
+ }
68
+
69
+ .success {
70
+ color: #0CC52B;
71
+ }
72
+
73
+ .failed {
74
+ color: #E90A1B;
75
+ }
76
+
77
+ .unknown {
78
+ color: #995000;
79
+ }
80
+ pre, code {
81
+ font-family: monospace;
82
+ font-size: 90%;
83
+ line-height: 1.4em;
84
+ color: #ff8;
85
+ background-color: #111;
86
+ width: 40em;
87
+ padding: 2px 10px 2px 10px;
88
+ }
89
+ .comment { color: #aaa; font-style: italic; }
90
+ .keyword { color: #eff; font-weight: bold; }
91
+ .punct { color: #eee; font-weight: bold; }
92
+ .symbol { color: #0bb; }
93
+ .string { color: #6b4; }
94
+ .ident { color: #ff8; }
95
+ .constant { color: #66f; }
96
+ .regex { color: #ec6; }
97
+ .number { color: #F99; }
98
+ .expr { color: #227; }
99
+
100
+ .sidebar {
101
+ float: right;
102
+ }
103
+
104
+ #version {
105
+ width: 217px;
106
+ text-align: right;
107
+ font-family: sans-serif;
108
+ font-weight: normal;
109
+ color: #141331;
110
+ padding: 15px 20px 10px 20px;
111
+ margin: 0 auto;
112
+ margin-top: 15px;
113
+ background-color: #9A5535;
114
+ border: 3px solid #7E393E;
115
+ }
116
+
117
+ #version .numbers {
118
+ display: block;
119
+ font-size: 4em;
120
+ line-height: 0.8em;
121
+ letter-spacing: -0.1ex;
122
+ margin-bottom: 15px;
123
+ }
124
+
125
+ #version p {
126
+ text-decoration: none;
127
+ color: #F1F4FF;
128
+ background-color: #9A5535;
129
+ margin: 0;
130
+ padding: 0;
131
+ }
132
+
133
+ #version a {
134
+ text-decoration: none;
135
+ color: #F1F4FF;
136
+ background-color: #9A5535;
137
+ }
138
+
139
+ .clickable {
140
+ cursor: pointer;
141
+ cursor: hand;
142
+ }
143
+
144
+ #twitter_search {
145
+ margin: 40px 0 10px 15px;
146
+ color: #F1F4FF;
147
+ background-color: #9A5535;
148
+ border: 3px solid #7E393E;
149
+ }
150
+
151
+ #twitter_search h3 {
152
+ color: #F1F4FF;
153
+ margin-bottom: 0px;
154
+ }
155
+
156
+ #twitter_search center b {
157
+ display: none;
158
+ }
159
+
@@ -0,0 +1,50 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
+ <title>
8
+ <%= title %>
9
+ </title>
10
+ <script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
11
+ <style>
12
+
13
+ </style>
14
+ <script type="text/javascript">
15
+ window.onload = function() {
16
+ settings = {
17
+ tl: { radius: 10 },
18
+ tr: { radius: 10 },
19
+ bl: { radius: 10 },
20
+ br: { radius: 10 },
21
+ antiAlias: true,
22
+ autoPad: true,
23
+ validTags: ["div"]
24
+ }
25
+ var versionBox = new curvyCorners(settings, document.getElementById("version"));
26
+ versionBox.applyCornersToAll();
27
+ }
28
+ </script>
29
+ </head>
30
+ <body>
31
+ <div id="main">
32
+
33
+ <h1><%= title %></h1>
34
+ <div class="sidebar">
35
+ <div id="version" class="clickable" onclick='document.location = "<%= download %>"; return false'>
36
+ <p>Get Version</p>
37
+ <a href="<%= download %>" class="numbers"><%= version %></a>
38
+ </div>
39
+ </div>
40
+ <%= body %>
41
+ <p class="coda">
42
+ <a href="FIXME email">FIXME full name</a>, <%= modified.pretty %><br>
43
+ Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
44
+ </p>
45
+ </div>
46
+
47
+ <!-- insert site tracking codes here, like Google Urchin -->
48
+
49
+ </body>
50
+ </html>
metadata CHANGED
@@ -1,54 +1,92 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typed_accessors
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.2"
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Dague
8
- autorequire: typed_accessors
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-29 00:00:00 -04:00
12
+ date: 2010-03-09 00:00:00 -05:00
13
13
  default_executable:
14
- dependencies: []
15
-
16
- description: Defines easy to use additional functions to creating typed accessors, which auto convert the attributes to non string types
17
- email: sean@dague.net
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rubyforge
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.0.3
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: gemcutter
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.0
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: hoe
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 2.5.0
44
+ version:
45
+ description: |-
46
+ Typed accessors creates a set of accessors with a predefined typed.
47
+ Often when dealing with webservices all the data comes back as
48
+ strings, but you really want to be working with these things as
49
+ numbers or dates. Manually converting them is duplication, and can be
50
+ error prone.
51
+ email:
52
+ - sean@dague.net
18
53
  executables: []
19
54
 
20
55
  extensions: []
21
56
 
22
57
  extra_rdoc_files:
23
- - README
24
- - COPYING
58
+ - History.txt
59
+ - Manifest.txt
60
+ - PostInstall.txt
61
+ - website/index.txt
25
62
  files:
26
- - test/basic_test.rb
27
- - lib/typed_accessors.rb
28
- - docs/typed_accessors
29
- - docs/typed_accessors/created.rid
30
- - docs/typed_accessors/rdoc-style.css
31
- - docs/typed_accessors/classes
32
- - docs/typed_accessors/classes/Class.html
33
- - docs/typed_accessors/fr_method_index.html
34
- - docs/typed_accessors/fr_class_index.html
35
- - docs/typed_accessors/fr_file_index.html
36
- - docs/typed_accessors/index.html
37
- - docs/typed_accessors/files
38
- - docs/typed_accessors/files/COPYING.html
39
- - docs/typed_accessors/files/README.html
40
- - docs/typed_accessors/files/lib
41
- - docs/typed_accessors/files/lib/typed_accessors_rb.html
63
+ - History.txt
64
+ - Manifest.txt
65
+ - PostInstall.txt
66
+ - README.rdoc
42
67
  - Rakefile
43
- - README
44
- - COPYING
68
+ - config/website.yml
69
+ - lib/typed_accessors.rb
70
+ - lib/typed_accessors/class.rb
71
+ - script/console
72
+ - script/destroy
73
+ - script/generate
74
+ - script/txt2html
75
+ - test/test_helper.rb
76
+ - test/test_typed_accessors.rb
77
+ - website/index.html
78
+ - website/index.txt
79
+ - website/javascripts/rounded_corners_lite.inc.js
80
+ - website/stylesheets/screen.css
81
+ - website/template.html.erb
45
82
  has_rdoc: true
46
83
  homepage: http://github.com/sdague/typed_accessors
47
- post_install_message:
84
+ licenses: []
85
+
86
+ post_install_message: PostInstall.txt
48
87
  rdoc_options:
49
88
  - --main
50
- - README
51
- - --accessor int_accessor="RW int" --accessor int_reader="R int" --accessor int_writer="W int" --accessor float_accessor="RW float" --accessor float_reader="R float" --accessor float_writer="W float" --accessor bool_yn_accessor="RW bool" --accessor bool_yn_reader="R bool" --accessor bool_yn_writer="W bool"
89
+ - README.rdoc
52
90
  require_paths:
53
91
  - lib
54
92
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -65,10 +103,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
103
  version:
66
104
  requirements: []
67
105
 
68
- rubyforge_project: http://rubyforge.org/projects/sdaguegems
69
- rubygems_version: 1.3.1
106
+ rubyforge_project: sdaguegems
107
+ rubygems_version: 1.3.5
70
108
  signing_key:
71
- specification_version: 2
72
- summary: Predefined typed accessors
73
- test_files: []
74
-
109
+ specification_version: 3
110
+ summary: Typed accessors creates a set of accessors with a predefined typed
111
+ test_files:
112
+ - test/test_typed_accessors.rb
113
+ - test/test_helper.rb
data/COPYING DELETED
@@ -1,21 +0,0 @@
1
- The MIT License
2
-
3
- Copyright (c) 2009 Patrick Ladd, Sean Dague <http://dague.net>
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
data/README DELETED
@@ -1,50 +0,0 @@
1
- = Overview
2
-
3
- Typed accessors creates a set of accessors with a predefined typed.
4
- Often when dealing with webservices all the data comes back as
5
- strings, but you really want to be working with these things as
6
- numbers or dates. Manually converting them is duplication, and can be
7
- error prone.
8
-
9
- == Example
10
-
11
- class Foo
12
- float_accessor :float
13
- date_accessor :date
14
- end
15
-
16
- >> f = Foo.new
17
- => #<Foo:0xb7a3dd44>
18
- >> f.float = "1.4"
19
- => "1.4"
20
- >> f.float
21
- => 1.4
22
- >> f.float = "1"
23
- => "1"
24
- >> f.float
25
- => 1.0
26
- >> f.date = "2009-10-30"
27
- => "2009-10-30"
28
- >> f.date
29
- => #<Date: 4910269/2,0,2299161>
30
- >> f.date.to_s
31
- => "2009-10-30"
32
-
33
- == Installation
34
-
35
- First install the gem
36
-
37
- gem install typed_accesors
38
-
39
- Then include it in your environment
40
-
41
- require "typed_accessors"
42
-
43
- == Authors
44
-
45
- Creator: Pat Ladd
46
- Packager: Sean Dague
47
-
48
- == License
49
-
50
- This is released under an MIT license, see COPYING for full details.
@@ -1,260 +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>Class: Class</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">Class</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/typed_accessors_rb.html">
59
- lib/typed_accessors.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
- Typed accessors works as a Mixin on <a href="Class.html">Class</a>. It
84
- creates a set of functions that are used in the class definition which eval
85
- and create new accessor methods at class eval time (so little performance
86
- penalty). For now, this is limitted to built in types, float, int, boolean,
87
- and date, though this approach could clearly be expanded.
88
- </p>
89
- <p>
90
- Example of a class definition
91
- </p>
92
- <pre>
93
- class MyClass
94
- float_accessor :distance
95
- int_accessor :count
96
- bool_yn_accessor :onfire
97
- date_accessor :day
98
- end
99
- </pre>
100
-
101
- </div>
102
-
103
-
104
- </div>
105
-
106
- <div id="method-list">
107
- <h3 class="section-bar">Methods</h3>
108
-
109
- <div class="name-list">
110
- <a href="#M000001">bool_yn_accessor</a>&nbsp;&nbsp;
111
- <a href="#M000004">date_accessor</a>&nbsp;&nbsp;
112
- <a href="#M000002">float_accessor</a>&nbsp;&nbsp;
113
- <a href="#M000003">int_accessor</a>&nbsp;&nbsp;
114
- </div>
115
- </div>
116
-
117
- </div>
118
-
119
-
120
- <!-- if includes -->
121
-
122
- <div id="section">
123
-
124
-
125
-
126
-
127
-
128
-
129
-
130
-
131
- <!-- if method_list -->
132
- <div id="methods">
133
- <h3 class="section-bar">Public Instance methods</h3>
134
-
135
- <div id="method-M000001" class="method-detail">
136
- <a name="M000001"></a>
137
-
138
- <div class="method-heading">
139
- <a href="#M000001" class="method-signature">
140
- <span class="method-name">bool_yn_accessor</span><span class="method-args">( *symbols )</span>
141
- </a>
142
- </div>
143
-
144
- <div class="method-description">
145
- <p>
146
- Creates a boolean accessor. It will convert and incoming string to a true /
147
- false value. If the string is &quot;y&quot; or &quot;yes&quot; it will be
148
- true, otherwise false.
149
- </p>
150
- <p><a class="source-toggle" href="#"
151
- onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
152
- <div class="method-source-code" id="M000001-source">
153
- <pre>
154
- <span class="ruby-comment cmt"># File lib/typed_accessors.rb, line 22</span>
155
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">bool_yn_accessor</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">symbols</span> )
156
- <span class="ruby-identifier">attr_reader</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">symbols</span> )
157
- <span class="ruby-identifier">bool_yn_writer</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">symbols</span> )
158
- <span class="ruby-keyword kw">end</span>
159
- </pre>
160
- </div>
161
- </div>
162
- </div>
163
-
164
- <div id="method-M000004" class="method-detail">
165
- <a name="M000004"></a>
166
-
167
- <div class="method-heading">
168
- <a href="#M000004" class="method-signature">
169
- <span class="method-name">date_accessor</span><span class="method-args">( *symbols )</span>
170
- </a>
171
- </div>
172
-
173
- <div class="method-description">
174
- <p>
175
- Creates a data accessor using the Date parse function on strings. Not
176
- defined for other input types.
177
- </p>
178
- <p><a class="source-toggle" href="#"
179
- onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
180
- <div class="method-source-code" id="M000004-source">
181
- <pre>
182
- <span class="ruby-comment cmt"># File lib/typed_accessors.rb, line 44</span>
183
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">date_accessor</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">symbols</span> )
184
- <span class="ruby-identifier">attr_reader</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">symbols</span> )
185
- <span class="ruby-identifier">date_writer</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">symbols</span> )
186
- <span class="ruby-keyword kw">end</span>
187
- </pre>
188
- </div>
189
- </div>
190
- </div>
191
-
192
- <div id="method-M000002" class="method-detail">
193
- <a name="M000002"></a>
194
-
195
- <div class="method-heading">
196
- <a href="#M000002" class="method-signature">
197
- <span class="method-name">float_accessor</span><span class="method-args">( *symbols )</span>
198
- </a>
199
- </div>
200
-
201
- <div class="method-description">
202
- <p>
203
- Creates a float accessor, using built in .to_f functions on objects. Any
204
- object that has a .to_f is supported.
205
- </p>
206
- <p><a class="source-toggle" href="#"
207
- onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
208
- <div class="method-source-code" id="M000002-source">
209
- <pre>
210
- <span class="ruby-comment cmt"># File lib/typed_accessors.rb, line 30</span>
211
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">float_accessor</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">symbols</span> )
212
- <span class="ruby-identifier">attr_reader</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">symbols</span> )
213
- <span class="ruby-identifier">float_writer</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">symbols</span> )
214
- <span class="ruby-keyword kw">end</span>
215
- </pre>
216
- </div>
217
- </div>
218
- </div>
219
-
220
- <div id="method-M000003" class="method-detail">
221
- <a name="M000003"></a>
222
-
223
- <div class="method-heading">
224
- <a href="#M000003" class="method-signature">
225
- <span class="method-name">int_accessor</span><span class="method-args">( *symbols )</span>
226
- </a>
227
- </div>
228
-
229
- <div class="method-description">
230
- <p>
231
- Creates an int accessor, using built in .to_i functions on objects. Any
232
- object that has a .to_i is supported.
233
- </p>
234
- <p><a class="source-toggle" href="#"
235
- onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
236
- <div class="method-source-code" id="M000003-source">
237
- <pre>
238
- <span class="ruby-comment cmt"># File lib/typed_accessors.rb, line 37</span>
239
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">int_accessor</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">symbols</span> )
240
- <span class="ruby-identifier">attr_reader</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">symbols</span> )
241
- <span class="ruby-identifier">int_writer</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">symbols</span> )
242
- <span class="ruby-keyword kw">end</span>
243
- </pre>
244
- </div>
245
- </div>
246
- </div>
247
-
248
-
249
- </div>
250
-
251
-
252
- </div>
253
-
254
-
255
- <div id="validator-badges">
256
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
257
- </div>
258
-
259
- </body>
260
- </html>