mongoid_money_field 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.idea/misc.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectResources">
4
+ <default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
5
+ </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="ruby-1.9.3-p0" project-jdk-type="RUBY_SDK" />
7
+ </project>
8
+
@@ -0,0 +1,5 @@
1
+ <component name="DependencyValidationManager">
2
+ <state>
3
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
4
+ </state>
5
+ </component>
@@ -0,0 +1,378 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="1fff9bda-30c8-41ef-8052-f43ac92d37d3" name="Default" comment="">
5
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/scopes/scope_settings.xml" />
6
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/lib/mongoid_money_field.rb" />
7
+ <change type="DELETED" beforePath="R:\plugins\money_mongoid\lib\money_mongoid.rb" afterPath="" />
8
+ <change type="DELETED" beforePath="R:\plugins\money_mongoid\spec\money_mongoid_spec.rb" afterPath="" />
9
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/Gemfile" afterPath="$PROJECT_DIR$/Gemfile" />
10
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/README.rdoc" afterPath="$PROJECT_DIR$/README.rdoc" />
11
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/spec/spec_helper.rb" afterPath="$PROJECT_DIR$/spec/spec_helper.rb" />
12
+ </list>
13
+ <ignored path="money_mongoid.iws" />
14
+ <ignored path=".idea/workspace.xml" />
15
+ <option name="TRACKING_ENABLED" value="true" />
16
+ <option name="SHOW_DIALOG" value="false" />
17
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
18
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
19
+ <option name="LAST_RESOLUTION" value="IGNORE" />
20
+ </component>
21
+ <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
22
+ <component name="CreatePatchCommitExecutor">
23
+ <option name="PATCH_PATH" value="" />
24
+ </component>
25
+ <component name="DaemonCodeAnalyzer">
26
+ <disable_hints />
27
+ </component>
28
+ <component name="FavoritesManager">
29
+ <favorites_list name="money_mongoid" />
30
+ </component>
31
+ <component name="FileEditorManager">
32
+ <splitter split-orientation="vertical" split-proportion="0.30901858">
33
+ <split-first>
34
+ <leaf>
35
+ <file leaf-file-name="money_spec.rb" pinned="false" current="false" current-in-tab="false">
36
+ <entry file="file://$PROJECT_DIR$/spec/money_spec.rb">
37
+ <provider selected="true" editor-type-id="text-editor">
38
+ <state line="3" column="2" selection-start="57" selection-end="57" vertical-scroll-proportion="0.0">
39
+ <folding />
40
+ </state>
41
+ </provider>
42
+ </entry>
43
+ </file>
44
+ <file leaf-file-name="spec_helper.rb" pinned="false" current="false" current-in-tab="true">
45
+ <entry file="file://$PROJECT_DIR$/spec/spec_helper.rb">
46
+ <provider selected="true" editor-type-id="text-editor">
47
+ <state line="10" column="28" selection-start="219" selection-end="238" vertical-scroll-proportion="0.64215684">
48
+ <folding />
49
+ </state>
50
+ </provider>
51
+ </entry>
52
+ </file>
53
+ <file leaf-file-name="dummy_money.rb" pinned="false" current="false" current-in-tab="false">
54
+ <entry file="file://$PROJECT_DIR$/spec/support/dummy_money.rb">
55
+ <provider selected="true" editor-type-id="text-editor">
56
+ <state line="2" column="29" selection-start="64" selection-end="74" vertical-scroll-proportion="0.0">
57
+ <folding />
58
+ </state>
59
+ </provider>
60
+ </entry>
61
+ </file>
62
+ </leaf>
63
+ </split-first>
64
+ <split-second>
65
+ <leaf>
66
+ <file leaf-file-name="mongoid_money_field.rb" pinned="false" current="false" current-in-tab="false">
67
+ <entry file="file://$PROJECT_DIR$/lib/mongoid_money_field.rb">
68
+ <provider selected="true" editor-type-id="text-editor">
69
+ <state line="3" column="19" selection-start="51" selection-end="51" vertical-scroll-proportion="0.0">
70
+ <folding />
71
+ </state>
72
+ </provider>
73
+ </entry>
74
+ </file>
75
+ <file leaf-file-name="Gemfile" pinned="false" current="false" current-in-tab="false">
76
+ <entry file="file://$PROJECT_DIR$/Gemfile">
77
+ <provider selected="true" editor-type-id="text-editor">
78
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
79
+ <folding />
80
+ </state>
81
+ </provider>
82
+ </entry>
83
+ </file>
84
+ <file leaf-file-name="README.rdoc" pinned="false" current="true" current-in-tab="true">
85
+ <entry file="file://$PROJECT_DIR$/README.rdoc">
86
+ <provider selected="true" editor-type-id="text-editor">
87
+ <state line="15" column="28" selection-start="290" selection-end="290" vertical-scroll-proportion="0.067073174">
88
+ <folding />
89
+ </state>
90
+ </provider>
91
+ </entry>
92
+ </file>
93
+ </leaf>
94
+ </split-second>
95
+ </splitter>
96
+ </component>
97
+ <component name="FindManager">
98
+ <FindUsagesManager>
99
+ <setting name="OPEN_NEW_TAB" value="false" />
100
+ </FindUsagesManager>
101
+ </component>
102
+ <component name="Git.Settings">
103
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
104
+ </component>
105
+ <component name="IdeDocumentHistory">
106
+ <option name="changedFiles">
107
+ <list>
108
+ <option value="$PROJECT_DIR$/lib/money_mongoid.rb" />
109
+ <option value="$PROJECT_DIR$/spec/support/dummy_money.rb" />
110
+ <option value="$PROJECT_DIR$/spec/money_spec.rb" />
111
+ <option value="$PROJECT_DIR$/spec/spec_helper.rb" />
112
+ <option value="$PROJECT_DIR$/lib/mongoid_money_field.rb" />
113
+ <option value="$PROJECT_DIR$/README.rdoc" />
114
+ </list>
115
+ </option>
116
+ </component>
117
+ <component name="ProjectFrameBounds">
118
+ <option name="x" value="-8" />
119
+ <option name="y" value="-8" />
120
+ <option name="width" value="1616" />
121
+ <option name="height" value="886" />
122
+ </component>
123
+ <component name="ProjectLevelVcsManager" settingsEditedManually="false">
124
+ <OptionsSetting value="true" id="Add" />
125
+ <OptionsSetting value="true" id="Remove" />
126
+ <OptionsSetting value="true" id="Checkout" />
127
+ <OptionsSetting value="true" id="Update" />
128
+ <OptionsSetting value="true" id="Status" />
129
+ <OptionsSetting value="true" id="Edit" />
130
+ <ConfirmationsSetting value="2" id="Add" />
131
+ <ConfirmationsSetting value="0" id="Remove" />
132
+ </component>
133
+ <component name="ProjectReloadState">
134
+ <option name="STATE" value="0" />
135
+ </component>
136
+ <component name="ProjectView">
137
+ <navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
138
+ <flattenPackages />
139
+ <showMembers />
140
+ <showModules />
141
+ <showLibraryContents />
142
+ <hideEmptyPackages />
143
+ <abbreviatePackageNames />
144
+ <autoscrollToSource />
145
+ <autoscrollFromSource />
146
+ <sortByType />
147
+ </navigator>
148
+ <panes>
149
+ <pane id="Scope">
150
+ <subPane subId="Project Files">
151
+ <PATH>
152
+ <PATH_ELEMENT USER_OBJECT="Root">
153
+ <option name="myItemId" value="" />
154
+ <option name="myItemType" value="" />
155
+ </PATH_ELEMENT>
156
+ </PATH>
157
+ </subPane>
158
+ </pane>
159
+ <pane id="ProjectPane">
160
+ <subPane>
161
+ <PATH>
162
+ <PATH_ELEMENT>
163
+ <option name="myItemId" value="money_mongoid" />
164
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
165
+ </PATH_ELEMENT>
166
+ </PATH>
167
+ <PATH>
168
+ <PATH_ELEMENT>
169
+ <option name="myItemId" value="money_mongoid" />
170
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
171
+ </PATH_ELEMENT>
172
+ <PATH_ELEMENT>
173
+ <option name="myItemId" value="money_mongoid" />
174
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
175
+ </PATH_ELEMENT>
176
+ </PATH>
177
+ <PATH>
178
+ <PATH_ELEMENT>
179
+ <option name="myItemId" value="money_mongoid" />
180
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
181
+ </PATH_ELEMENT>
182
+ <PATH_ELEMENT>
183
+ <option name="myItemId" value="money_mongoid" />
184
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
185
+ </PATH_ELEMENT>
186
+ <PATH_ELEMENT>
187
+ <option name="myItemId" value="spec" />
188
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
189
+ </PATH_ELEMENT>
190
+ </PATH>
191
+ <PATH>
192
+ <PATH_ELEMENT>
193
+ <option name="myItemId" value="money_mongoid" />
194
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
195
+ </PATH_ELEMENT>
196
+ <PATH_ELEMENT>
197
+ <option name="myItemId" value="money_mongoid" />
198
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
199
+ </PATH_ELEMENT>
200
+ <PATH_ELEMENT>
201
+ <option name="myItemId" value="spec" />
202
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
203
+ </PATH_ELEMENT>
204
+ <PATH_ELEMENT>
205
+ <option name="myItemId" value="support" />
206
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
207
+ </PATH_ELEMENT>
208
+ </PATH>
209
+ <PATH>
210
+ <PATH_ELEMENT>
211
+ <option name="myItemId" value="money_mongoid" />
212
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
213
+ </PATH_ELEMENT>
214
+ <PATH_ELEMENT>
215
+ <option name="myItemId" value="money_mongoid" />
216
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
217
+ </PATH_ELEMENT>
218
+ <PATH_ELEMENT>
219
+ <option name="myItemId" value="lib" />
220
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
221
+ </PATH_ELEMENT>
222
+ </PATH>
223
+ </subPane>
224
+ </pane>
225
+ </panes>
226
+ </component>
227
+ <component name="PropertiesComponent">
228
+ <property name="WebServerToolWindowFactoryState" value="false" />
229
+ </component>
230
+ <component name="RunManager">
231
+ <configuration default="true" type="RubyRunConfigurationType" factoryName="Ruby">
232
+ <module name="" />
233
+ <RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
234
+ <RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="" />
235
+ <RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
236
+ <RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
237
+ <RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
238
+ <envs />
239
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
240
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov" />
241
+ <RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="" />
242
+ <RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
243
+ <method>
244
+ <option name="RakeTask" enabled="false" />
245
+ </method>
246
+ </configuration>
247
+ <list size="0" />
248
+ </component>
249
+ <component name="ShelveChangesManager" show_recycled="false" />
250
+ <component name="TaskManager">
251
+ <task active="true" id="Default" summary="Default task">
252
+ <created>1330843246846</created>
253
+ <updated>1330843246846</updated>
254
+ </task>
255
+ <servers />
256
+ </component>
257
+ <component name="ToolWindowManager">
258
+ <frame x="-8" y="-8" width="1616" height="886" extended-state="6" />
259
+ <editor active="true" />
260
+ <layout>
261
+ <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32891247" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
262
+ <window_info id="Data Sources" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
263
+ <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
264
+ <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
265
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32891247" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
266
+ <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
267
+ <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25" sideWeight="0.6710875" order="0" side_tool="false" content_ui="combo" />
268
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
269
+ <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
270
+ <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
271
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
272
+ <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
273
+ <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
274
+ <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
275
+ <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
276
+ <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
277
+ <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
278
+ <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
279
+ </layout>
280
+ </component>
281
+ <component name="VcsContentAnnotationSettings">
282
+ <option name="myLimit" value="2678400000" />
283
+ </component>
284
+ <component name="VcsManagerConfiguration">
285
+ <option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
286
+ <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" />
287
+ <option name="CHECK_NEW_TODO" value="true" />
288
+ <option name="myTodoPanelSettings">
289
+ <value>
290
+ <are-packages-shown value="false" />
291
+ <are-modules-shown value="false" />
292
+ <flatten-packages value="false" />
293
+ <is-autoscroll-to-source value="false" />
294
+ </value>
295
+ </option>
296
+ <option name="PERFORM_UPDATE_IN_BACKGROUND" value="true" />
297
+ <option name="PERFORM_COMMIT_IN_BACKGROUND" value="true" />
298
+ <option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
299
+ <option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true" />
300
+ <option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
301
+ <option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false" />
302
+ <option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="false" />
303
+ <option name="ENABLE_BACKGROUND_PROCESSES" value="false" />
304
+ <option name="CHANGED_ON_SERVER_INTERVAL" value="60" />
305
+ <option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" />
306
+ <option name="CHECK_COMMIT_MESSAGE_SPELLING" value="true" />
307
+ <option name="DEFAULT_PATCH_EXTENSION" value="patch" />
308
+ <option name="SHORT_DIFF_HORISONTALLY" value="true" />
309
+ <option name="SHORT_DIFF_EXTRA_LINES" value="2" />
310
+ <option name="SOFT_WRAPS_IN_SHORT_DIFF" value="true" />
311
+ <option name="INCLUDE_TEXT_INTO_PATCH" value="false" />
312
+ <option name="INCLUDE_TEXT_INTO_SHELF" value="false" />
313
+ <option name="CREATE_PATCH_EXPAND_DETAILS_DEFAULT" value="true" />
314
+ <option name="SHOW_FILE_HISTORY_DETAILS" value="true" />
315
+ <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
316
+ <option name="LAST_COMMIT_MESSAGE" />
317
+ <option name="MAKE_NEW_CHANGELIST_ACTIVE" value="false" />
318
+ <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
319
+ <option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
320
+ <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
321
+ <option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
322
+ <option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
323
+ <option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
324
+ <option name="ACTIVE_VCS_NAME" />
325
+ <option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
326
+ <option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
327
+ <option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
328
+ <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
329
+ </component>
330
+ <component name="XDebuggerManager">
331
+ <breakpoint-manager />
332
+ </component>
333
+ <component name="editorHistoryManager">
334
+ <entry file="file://$PROJECT_DIR$/spec/support/dummy_money.rb">
335
+ <provider selected="true" editor-type-id="text-editor">
336
+ <state line="2" column="29" selection-start="64" selection-end="74" vertical-scroll-proportion="0.0">
337
+ <folding />
338
+ </state>
339
+ </provider>
340
+ </entry>
341
+ <entry file="file://$PROJECT_DIR$/lib/mongoid_money_field.rb">
342
+ <provider selected="true" editor-type-id="text-editor">
343
+ <state line="3" column="19" selection-start="51" selection-end="51" vertical-scroll-proportion="0.0">
344
+ <folding />
345
+ </state>
346
+ </provider>
347
+ </entry>
348
+ <entry file="file://$PROJECT_DIR$/Gemfile">
349
+ <provider selected="true" editor-type-id="text-editor">
350
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
351
+ <folding />
352
+ </state>
353
+ </provider>
354
+ </entry>
355
+ <entry file="file://$PROJECT_DIR$/spec/money_spec.rb">
356
+ <provider selected="true" editor-type-id="text-editor">
357
+ <state line="3" column="2" selection-start="57" selection-end="57" vertical-scroll-proportion="0.0">
358
+ <folding />
359
+ </state>
360
+ </provider>
361
+ </entry>
362
+ <entry file="file://$PROJECT_DIR$/spec/spec_helper.rb">
363
+ <provider selected="true" editor-type-id="text-editor">
364
+ <state line="10" column="28" selection-start="219" selection-end="238" vertical-scroll-proportion="0.64215684">
365
+ <folding />
366
+ </state>
367
+ </provider>
368
+ </entry>
369
+ <entry file="file://$PROJECT_DIR$/README.rdoc">
370
+ <provider selected="true" editor-type-id="text-editor">
371
+ <state line="15" column="28" selection-start="290" selection-end="290" vertical-scroll-proportion="0.067073174">
372
+ <folding />
373
+ </state>
374
+ </provider>
375
+ </entry>
376
+ </component>
377
+ </project>
378
+
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'mongoid'
4
+ gem 'money'
5
+
6
+ group :development do
7
+ gem "rspec", "~> 2.8.0"
8
+ gem "rdoc", "~> 3.12"
9
+ gem "bundler", "~> 1.0.0"
10
+ gem "jeweler", "~> 1.8.3"
11
+ gem "simplecov", '>= 0.4.0', :require => false
12
+ gem "database_cleaner"
13
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,60 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activemodel (3.2.2)
5
+ activesupport (= 3.2.2)
6
+ builder (~> 3.0.0)
7
+ activesupport (3.2.2)
8
+ i18n (~> 0.6)
9
+ multi_json (~> 1.0)
10
+ bson (1.6.0)
11
+ builder (3.0.0)
12
+ database_cleaner (0.7.1)
13
+ diff-lcs (1.1.3)
14
+ git (1.2.5)
15
+ i18n (0.6.0)
16
+ jeweler (1.8.3)
17
+ bundler (~> 1.0)
18
+ git (>= 1.2.5)
19
+ rake
20
+ rdoc
21
+ json (1.6.5)
22
+ money (4.0.2)
23
+ i18n (~> 0.4)
24
+ json
25
+ mongo (1.6.0)
26
+ bson (= 1.6.0)
27
+ mongoid (2.4.5)
28
+ activemodel (~> 3.1)
29
+ mongo (~> 1.3)
30
+ tzinfo (~> 0.3.22)
31
+ multi_json (1.1.0)
32
+ rake (0.9.2.2)
33
+ rdoc (3.12)
34
+ json (~> 1.4)
35
+ rspec (2.8.0)
36
+ rspec-core (~> 2.8.0)
37
+ rspec-expectations (~> 2.8.0)
38
+ rspec-mocks (~> 2.8.0)
39
+ rspec-core (2.8.0)
40
+ rspec-expectations (2.8.0)
41
+ diff-lcs (~> 1.1.2)
42
+ rspec-mocks (2.8.0)
43
+ simplecov (0.6.1)
44
+ multi_json (~> 1.0)
45
+ simplecov-html (~> 0.5.3)
46
+ simplecov-html (0.5.3)
47
+ tzinfo (0.3.31)
48
+
49
+ PLATFORMS
50
+ ruby
51
+
52
+ DEPENDENCIES
53
+ bundler (~> 1.0.0)
54
+ database_cleaner
55
+ jeweler (~> 1.8.3)
56
+ money
57
+ mongoid
58
+ rdoc (~> 3.12)
59
+ rspec (~> 2.8.0)
60
+ simplecov (>= 0.4.0)
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 glebtv
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,38 @@
1
+ == mongoid money field
2
+
3
+ This is a super simple gem to use RubyMoney money type columns with mongoid
4
+
5
+ https://github.com/RubyMoney/money
6
+ https://github.com/mongoid/mongoid
7
+
8
+ == Description
9
+
10
+ A simple gem that creates a Money datatype using RubyMoney for Mongoid.
11
+
12
+ Inspired by https://gist.github.com/840500
13
+
14
+ == Installation
15
+
16
+ Include the gem in your Gemfile
17
+
18
+ gem 'mongoid_money_field', git: 'git://github.com/glebtv/mongoid_money_field.git'
19
+
20
+ == Usage
21
+
22
+ class DummyMoney
23
+ include Mongoid::Document
24
+ include Mongoid::MoneyField
25
+
26
+ field :description
27
+
28
+ money_field :price
29
+
30
+ end
31
+
32
+ All Money values are converted and stored in mongo as cents and currency in two separate fields.
33
+
34
+
35
+ == Copyright
36
+
37
+ Copyright (c) 2012 glebtv. MIT License.
38
+
data/Rakefile ADDED
@@ -0,0 +1,44 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "mongoid_money_field"
18
+ gem.homepage = "http://github.com/glebtv/mongoid_money_field"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Use RubyMoney with mongoid}
21
+ gem.description = %Q{Use RubyMoney with mongoid}
22
+ gem.email = "glebtv@gmail.com"
23
+ gem.authors = ["glebtv"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
+ end
33
+
34
+ task :default => :spec
35
+
36
+ require 'rdoc/task'
37
+ Rake::RDocTask.new do |rdoc|
38
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
39
+
40
+ rdoc.rdoc_dir = 'rdoc'
41
+ rdoc.title = "mongoid_money_field #{version}"
42
+ rdoc.rdoc_files.include('README*')
43
+ rdoc.rdoc_files.include('lib/**/*.rb')
44
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
@@ -0,0 +1,42 @@
1
+ require 'money'
2
+
3
+ module Mongoid
4
+ module MoneyField
5
+ extend ActiveSupport::Concern
6
+ included do
7
+
8
+ end
9
+
10
+ module ClassMethods
11
+ def money_field(*columns)
12
+ [columns].flatten.each do |name|
13
+ attr_cents = (name.to_s + '_cents').to_sym
14
+ attr_currency = (name.to_s + '_currency').to_sym
15
+
16
+ field attr_cents, type: Integer, default: 0
17
+ field attr_currency, type: String, default: ::Money.default_currency.iso_code
18
+
19
+ define_method(name) do
20
+ cents = read_attribute(attr_cents)
21
+ currency = read_attribute(attr_currency)
22
+
23
+ Money.new(cents || 0, currency || ::Money.default_currency)
24
+ end
25
+
26
+ define_method("#{name}=") do |value|
27
+ if value.blank?
28
+ write_attribute(attr_cents, nil)
29
+ write_attribute(attr_currency, nil)
30
+ nil
31
+ else
32
+ money = value.to_money
33
+ write_attribute(attr_cents, money.cents)
34
+ write_attribute(attr_currency, money.currency.iso_code)
35
+ money
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,80 @@
1
+ require 'spec_helper'
2
+
3
+ describe Mongoid::MoneyField do
4
+
5
+ describe 'when persisting a document with a Money datatype' do
6
+
7
+ it 'should be persisted normally when set as dollars' do
8
+ dummy = DummyMoney.new
9
+ dummy.price = '$10'
10
+ dummy.save.should eq true
11
+ end
12
+
13
+ it 'should be persisted normally when set as cents' do
14
+ dummy = DummyMoney.new
15
+ dummy.price = '$9.99'
16
+ dummy.save.should eq true
17
+ end
18
+ end
19
+
20
+ describe 'when accessing a document from the datastore with a Money datatype' do
21
+ before(:each) do
22
+ DummyMoney.create(:description => "Test", :price => '9.99')
23
+ end
24
+
25
+ it 'should have a Money value that matches the money value that was initially persisted' do
26
+ dummy = DummyMoney.first
27
+ dummy.price.should eq Money.parse('9.99')
28
+ end
29
+ end
30
+
31
+ describe 'when accessing a document from the datastore with a Money datatype and empty value' do
32
+ before(:each) do
33
+ DummyMoney.create(:description => "Test")
34
+ end
35
+
36
+ it 'should have a Money value of 0' do
37
+ dummy = DummyMoney.first
38
+ dummy.price.should eq Money.parse('0')
39
+ end
40
+ end
41
+
42
+ describe 'should handle currency' do
43
+ it 'should have a Money value of 0' do
44
+ DummyMoney.create(description: "Test", price: '1.23 RUB')
45
+ dummy = DummyMoney.first
46
+ dummy.price.currency.iso_code.should eq 'RUB'
47
+ dummy.price.cents.should eq 123
48
+ end
49
+ end
50
+
51
+ describe 'when accessing a document from the datastore with a Money datatype and blank value' do
52
+ before(:each) do
53
+ DummyMoney.create(description: "Test", price: '')
54
+ end
55
+
56
+ it 'should have a Money value of 0' do
57
+ dummy = DummyMoney.first
58
+ dummy.price.should eq Money.parse('0')
59
+ end
60
+ end
61
+
62
+ describe 'when accessing a document from the datastore with multiple Money datatypes' do
63
+ before(:each) do
64
+ DummyPrices.create(description: "Test", price3: '1', price1: '1.23', price2: '2.33')
65
+ end
66
+
67
+ it 'should have correct Money value for field 1' do
68
+ dummy = DummyPrices.first
69
+ dummy.price1.should eq Money.parse('1.23')
70
+ end
71
+ it 'should have correct Money value for field 2' do
72
+ dummy = DummyPrices.first
73
+ dummy.price2.should eq Money.parse('2.33')
74
+ end
75
+ it 'should have correct Money value for field 3' do
76
+ dummy = DummyPrices.first
77
+ dummy.price3.should eq Money.parse('1')
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,38 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'simplecov'
5
+ require 'mongoid'
6
+
7
+ require 'database_cleaner'
8
+
9
+ SimpleCov.start
10
+
11
+ require 'mongoid_money_field'
12
+
13
+ # Requires supporting files with custom matchers and macros, etc,
14
+ # in ./support/ and its subdirectories.
15
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
16
+
17
+
18
+
19
+ Mongoid.config.master = Mongo::Connection.new.db("mongoid_money_field_test")
20
+ Mongoid.logger = Logger.new($stdout)
21
+
22
+ DatabaseCleaner.orm = "mongoid"
23
+
24
+ RSpec.configure do |config|
25
+ config.before(:all) do
26
+ DatabaseCleaner.strategy = :truncation
27
+ end
28
+
29
+ config.before(:each) do
30
+ DatabaseCleaner.start
31
+ end
32
+
33
+ config.after(:each) do
34
+ DatabaseCleaner.clean
35
+ end
36
+
37
+ config.mock_with :rspec
38
+ end
@@ -0,0 +1,9 @@
1
+ class DummyMoney
2
+ include Mongoid::Document
3
+ include Mongoid::MoneyField
4
+
5
+ field :description
6
+
7
+ money_field :price
8
+
9
+ end
@@ -0,0 +1,9 @@
1
+ class DummyPrices
2
+ include Mongoid::Document
3
+ include Mongoid::MoneyField
4
+
5
+ field :description
6
+
7
+ money_field :price1, :price2, :price3
8
+
9
+ end
metadata ADDED
@@ -0,0 +1,151 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mongoid_money_field
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - glebtv
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: mongoid
16
+ requirement: &85733050 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *85733050
25
+ - !ruby/object:Gem::Dependency
26
+ name: money
27
+ requirement: &85732810 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *85732810
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ requirement: &85732570 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 2.8.0
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *85732570
47
+ - !ruby/object:Gem::Dependency
48
+ name: rdoc
49
+ requirement: &85732330 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '3.12'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *85732330
58
+ - !ruby/object:Gem::Dependency
59
+ name: bundler
60
+ requirement: &85732090 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: 1.0.0
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *85732090
69
+ - !ruby/object:Gem::Dependency
70
+ name: jeweler
71
+ requirement: &85731850 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: 1.8.3
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *85731850
80
+ - !ruby/object:Gem::Dependency
81
+ name: simplecov
82
+ requirement: &85731610 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: 0.4.0
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *85731610
91
+ - !ruby/object:Gem::Dependency
92
+ name: database_cleaner
93
+ requirement: &85731370 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *85731370
102
+ description: Use RubyMoney with mongoid
103
+ email: glebtv@gmail.com
104
+ executables: []
105
+ extensions: []
106
+ extra_rdoc_files:
107
+ - LICENSE.txt
108
+ - README.rdoc
109
+ files:
110
+ - .document
111
+ - .idea/misc.xml
112
+ - .idea/scopes/scope_settings.xml
113
+ - .idea/workspace.xml
114
+ - .rspec
115
+ - Gemfile
116
+ - Gemfile.lock
117
+ - LICENSE.txt
118
+ - README.rdoc
119
+ - Rakefile
120
+ - VERSION
121
+ - lib/mongoid_money_field.rb
122
+ - spec/money_spec.rb
123
+ - spec/spec_helper.rb
124
+ - spec/support/dummy_money.rb
125
+ - spec/support/dummy_prices.rb
126
+ homepage: http://github.com/glebtv/mongoid_money_field
127
+ licenses:
128
+ - MIT
129
+ post_install_message:
130
+ rdoc_options: []
131
+ require_paths:
132
+ - lib
133
+ required_ruby_version: !ruby/object:Gem::Requirement
134
+ none: false
135
+ requirements:
136
+ - - ! '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ required_rubygems_version: !ruby/object:Gem::Requirement
140
+ none: false
141
+ requirements:
142
+ - - ! '>='
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ requirements: []
146
+ rubyforge_project:
147
+ rubygems_version: 1.8.15
148
+ signing_key:
149
+ specification_version: 3
150
+ summary: Use RubyMoney with mongoid
151
+ test_files: []