acts_as_price 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ Mon, 25 Apr 2011 15:18:30 -0700
@@ -0,0 +1,205 @@
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.rdoc</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.rdoc</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>README.rdoc
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Mon Apr 25 15:18:27 -0700 2011</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>INSTALLATION</h1>
73
+ <p>
74
+ rails plugin install git@github.com:jeroeningen/acts_as_price.git
75
+ </p>
76
+ <h1>USAGE</h1>
77
+ <p>
78
+ Create a column in the table of your database which you want to acts as a
79
+ price.
80
+ </p>
81
+ <p>
82
+ NOTE THAT THE COLUMN MUST BE OF THE TYPE INTEGER.
83
+ </p>
84
+ <p>
85
+ In your model add the following:
86
+ </p>
87
+ <ul>
88
+ <li>acts_as_price &lt;column_name&gt;, :validates = true
89
+
90
+ </li>
91
+ </ul>
92
+ <p>
93
+ &lt;column_name&gt; is the name of your database column e.g. price or
94
+ price_per_liter.
95
+ </p>
96
+ <p>
97
+ This plugin creates the following getters and setters:
98
+ </p>
99
+ <ul>
100
+ <li>&#8216;price_in_cents&#8217; and &#8217;&lt;column_name&gt;_in_cents&#8217;
101
+ sets and returns the price in cents
102
+
103
+ </li>
104
+ <li>&#8216;price&#8217; and &#8217;&lt;column_name&gt;&#8217; sets and returns
105
+ the price
106
+
107
+ </li>
108
+ </ul>
109
+ <h1>EXAMPLES</h1>
110
+ <p>
111
+ car = Car.new :price =&gt; 12999
112
+ </p>
113
+ <p>
114
+ car.price 12999.00
115
+ </p>
116
+ <p>
117
+ car.price_in_cents 1299900
118
+ </p>
119
+ <p>
120
+ fuel = Fueltype.new :price_per_liter =&gt; 1.12
121
+ </p>
122
+ <p>
123
+ fuel.price 1.12
124
+ </p>
125
+ <p>
126
+ fuel.price_in_cents 112
127
+ </p>
128
+ <p>
129
+ fuel.price_per_liter 1.12
130
+ </p>
131
+ <p>
132
+ fuel.price_per_liter_in_cents 1.12
133
+ </p>
134
+ <h1>RSPEC INTERGRATION</h1>
135
+ <p>
136
+ Acts As Price comes with a helper method to automatically test the plugin
137
+ using Rspec.
138
+ </p>
139
+ <p>
140
+ To use this method please add the following to your spec_helper.rb file:
141
+ </p>
142
+ <ul>
143
+ <li>config.include(ActsAsPriceHelper)
144
+
145
+ </li>
146
+ </ul>
147
+ <p>
148
+ Now you may add the following code to your spec-files for your models:
149
+ </p>
150
+ <pre>
151
+ context &quot;given an valid model&quot; do
152
+ it &quot;should acts as price&quot; do
153
+ test_acts_as_price_methods &lt;column_name&gt;, &lt;fixture or stub&gt;
154
+ end
155
+ end
156
+ </pre>
157
+ <h1>TESTING</h1>
158
+ <p>
159
+ To test the plugin use the command &#8216;rake test&#8217; or &#8216;rspec
160
+ spec/*_spec.rb&#8217; inside the dir
161
+ &#8217;~/vendor/plugins/acts_as_price&#8216;
162
+ </p>
163
+ <h1>NOTES</h1>
164
+ <p>
165
+ This plugin comes with Rspec tests. However this plugin assumes that you
166
+ have a database configuration, it actually don&#8216;t use the database for
167
+ the Rspec tests.
168
+ </p>
169
+ <h1>FEEDBACK AND BUGS REPORTS</h1>
170
+ <p>
171
+ For feedback and bug reports contact: jeroeningen@gmail.com
172
+ </p>
173
+
174
+ </div>
175
+
176
+
177
+ </div>
178
+
179
+
180
+ </div>
181
+
182
+
183
+ <!-- if includes -->
184
+
185
+ <div id="section">
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+ <!-- if method_list -->
195
+
196
+
197
+ </div>
198
+
199
+
200
+ <div id="validator-badges">
201
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
202
+ </div>
203
+
204
+ </body>
205
+ </html>
@@ -0,0 +1,101 @@
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: acts_as_price_helper.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>acts_as_price_helper.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/acts_as_price_helper.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Mon Apr 25 15:00:23 -0700 2011</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+
72
+
73
+ </div>
74
+
75
+
76
+ </div>
77
+
78
+
79
+ <!-- if includes -->
80
+
81
+ <div id="section">
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+ <!-- if method_list -->
91
+
92
+
93
+ </div>
94
+
95
+
96
+ <div id="validator-badges">
97
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
98
+ </div>
99
+
100
+ </body>
101
+ </html>
@@ -0,0 +1,101 @@
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: acts_as_price.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>acts_as_price.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/acts_as_price.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Mon Apr 25 15:00:23 -0700 2011</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+
72
+
73
+ </div>
74
+
75
+
76
+ </div>
77
+
78
+
79
+ <!-- if includes -->
80
+
81
+ <div id="section">
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+ <!-- if method_list -->
91
+
92
+
93
+ </div>
94
+
95
+
96
+ <div id="validator-badges">
97
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
98
+ </div>
99
+
100
+ </body>
101
+ </html>
@@ -0,0 +1,31 @@
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/ActiveRecord.html">ActiveRecord</a><br />
24
+ <a href="classes/ActiveRecord/Acts.html">ActiveRecord::Acts</a><br />
25
+ <a href="classes/ActiveRecord/Acts/Price.html">ActiveRecord::Acts::Price</a><br />
26
+ <a href="classes/ActiveRecord/Acts/Price/ClassMethods.html">ActiveRecord::Acts::Price::ClassMethods</a><br />
27
+ <a href="classes/ActsAsPriceHelper.html">ActsAsPriceHelper</a><br />
28
+ </div>
29
+ </div>
30
+ </body>
31
+ </html>
@@ -0,0 +1,29 @@
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/README_rdoc.html">README.rdoc</a><br />
24
+ <a href="files/lib/acts_as_price_rb.html">lib/acts_as_price.rb</a><br />
25
+ <a href="files/lib/acts_as_price_helper_rb.html">lib/acts_as_price_helper.rb</a><br />
26
+ </div>
27
+ </div>
28
+ </body>
29
+ </html>