motion-yapper 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -2
- data/.travis.yml +2 -0
- data/Gemfile +1 -0
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/lib/motion-yapper.rb +1 -0
- data/lib/yapper.rb +3 -5
- data/lib/yapper/config.rb +2 -0
- data/lib/yapper/db.rb +105 -40
- data/lib/yapper/document.rb +7 -4
- data/lib/yapper/document/callbacks.rb +0 -7
- data/lib/yapper/document/{persistance.rb → persistence.rb} +27 -21
- data/lib/yapper/document/relation.rb +29 -22
- data/lib/yapper/document/selection.rb +122 -54
- data/lib/yapper/extensions.rb +12 -24
- data/lib/yapper/settings.rb +43 -0
- data/lib/yapper/timestamps.rb +2 -0
- data/lib/yapper/version.rb +1 -1
- data/{yapper.gemspec → motion-yapper.gemspec} +0 -0
- data/spec/integration/{where_spec.rb → criteria_spec.rb} +78 -10
- data/spec/integration/db_spec.rb +70 -0
- data/spec/integration/defaults_spec.rb +37 -0
- data/spec/integration/extensions_spec.rb +14 -0
- data/spec/integration/{persistance_spec.rb → persistence_spec.rb} +0 -0
- data/spec/integration/relation_spec.rb +4 -4
- data/vendor/Podfile.lock +9 -11
- data/vendor/Pods/.build/libPods-CocoaLumberjack.a +0 -0
- data/vendor/Pods/.build/libPods-NSData+MD5Digest.a +0 -0
- data/vendor/Pods/.build/libPods-YapDatabase.a +0 -0
- data/vendor/Pods/.build/libPods.a +0 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDASLLogger.h +4 -4
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDAbstractDatabaseLogger.h +14 -14
- data/vendor/Pods/{CocoaLumberjack/Lumberjack/Extensions/ContextFilterLogFormatter.h → BuildHeaders/CocoaLumberjack/DDContextFilterLogFormatter.h} +6 -8
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDFileLogger.h +67 -32
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog+LOGV.h +99 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog.h +98 -65
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDMultiFormatter.h +30 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDTTYLogger.h +39 -25
- data/vendor/Pods/BuildHeaders/YapDatabase/NSDictionary+YapDatabase.h +8 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapCache.h +1 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapCollectionKey.h +3 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabase.h +4 -4
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseConnection.h +21 -19
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseDefaults.h +1 -1
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionPrivate.h +35 -31
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredView.h +8 -35
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewPrivate.h +0 -2
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTransaction.h +17 -17
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTypes.h +32 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchPrivate.h +8 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabasePrivate.h +43 -21
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationship.h +35 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipConnection.h +29 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipEdge.h +163 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipEdgePrivate.h +79 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipNode.h +99 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipOptions.h +59 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipPrivate.h +125 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipTransaction.h +384 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndex.h +49 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +10 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexSetupPrivate.h +18 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseTransaction.h +131 -21
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseView.h +48 -107
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewChange.h +2 -2
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewConnection.h +1 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewMappings.h +17 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewOptions.h +10 -3
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPrivate.h +18 -1
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTransaction.h +75 -24
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTypes.h +99 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.h +4 -4
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.m +51 -50
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.h +14 -14
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.m +546 -546
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.h +67 -32
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.m +1093 -907
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog+LOGV.h +99 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.h +98 -65
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.m +873 -748
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.h +39 -25
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.m +1284 -1243
- data/vendor/Pods/{BuildHeaders/CocoaLumberjack/ContextFilterLogFormatter.h → CocoaLumberjack/Lumberjack/Extensions/DDContextFilterLogFormatter.h} +6 -8
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/{ContextFilterLogFormatter.m → DDContextFilterLogFormatter.m} +70 -70
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDDispatchQueueLogFormatter.m +253 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDMultiFormatter.h +30 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDMultiFormatter.m +127 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/README.txt +1 -1
- data/vendor/Pods/CocoaLumberjack/README.markdown +52 -15
- data/vendor/Pods/Headers/CocoaLumberjack/DDASLLogger.h +4 -4
- data/vendor/Pods/Headers/CocoaLumberjack/DDAbstractDatabaseLogger.h +14 -14
- data/vendor/Pods/Headers/CocoaLumberjack/{ContextFilterLogFormatter.h → DDContextFilterLogFormatter.h} +6 -8
- data/vendor/Pods/Headers/CocoaLumberjack/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
- data/vendor/Pods/Headers/CocoaLumberjack/DDFileLogger.h +67 -32
- data/vendor/Pods/Headers/CocoaLumberjack/DDLog+LOGV.h +99 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDLog.h +98 -65
- data/vendor/Pods/Headers/CocoaLumberjack/DDMultiFormatter.h +30 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDTTYLogger.h +39 -25
- data/vendor/Pods/Headers/YapDatabase/YapCollectionKey.h +3 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabase.h +4 -4
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnection.h +21 -19
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredView.h +8 -35
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTransaction.h +17 -17
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTypes.h +32 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationship.h +35 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipConnection.h +29 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipEdge.h +163 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipNode.h +99 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipOptions.h +59 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipTransaction.h +384 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndex.h +49 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseTransaction.h +131 -21
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseView.h +48 -107
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChange.h +2 -2
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewConnection.h +1 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappings.h +17 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewOptions.h +10 -3
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTransaction.h +75 -24
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTypes.h +99 -0
- data/vendor/Pods/Headers/____Pods-CocoaLumberjack-prefix.h +2 -0
- data/vendor/Pods/Headers/____Pods-environment.h +15 -15
- data/vendor/Pods/Manifest.lock +9 -11
- data/vendor/Pods/Pods-CocoaLumberjack-Private.xcconfig +1 -1
- data/vendor/Pods/Pods-CocoaLumberjack-prefix.pch +2 -0
- data/vendor/Pods/Pods-NSData+MD5Digest-Private.xcconfig +1 -1
- data/vendor/Pods/Pods-YapDatabase-Private.xcconfig +1 -1
- data/vendor/Pods/{Pods-Acknowledgements.markdown → Pods-acknowledgements.markdown} +0 -37
- data/vendor/Pods/{Pods-Acknowledgements.plist → Pods-acknowledgements.plist} +0 -45
- data/vendor/Pods/Pods-environment.h +15 -15
- data/vendor/Pods/Pods.xcconfig +3 -3
- data/vendor/Pods/Pods.xcodeproj/project.pbxproj +2426 -3155
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-CocoaLumberjack.xcscheme +59 -0
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-NSData+MD5Digest.xcscheme +59 -0
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-YapDatabase.xcscheme +59 -0
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods.xcscheme +59 -0
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/xcschememanagement.plist +31 -0
- data/vendor/Pods/YapDatabase/README.md +3 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/Internal/YapDatabaseFilteredViewPrivate.h +0 -2
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.h +8 -35
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.m +25 -41
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.h +17 -17
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.m +403 -134
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTypes.h +32 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/Internal/YapDatabaseFullTextSearchPrivate.h +8 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.m +8 -8
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchTransaction.m +113 -62
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/Internal/YapDatabaseExtensionPrivate.h +35 -31
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtension.m +25 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.m +1 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.m +25 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipEdgePrivate.h +79 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipPrivate.h +125 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.h +35 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.m +129 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.h +29 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.m +802 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipEdge.h +163 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipEdge.m +408 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipNode.h +99 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.h +59 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.m +29 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipTransaction.h +384 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipTransaction.m +5254 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexPrivate.h +10 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexSetupPrivate.h +18 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.h +49 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.m +12 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.m +9 -8
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.m +62 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.m +148 -45
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPrivate.h +18 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.h +2 -2
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.m +15 -9
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.h +17 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.m +211 -64
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.h +48 -107
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.m +10 -7
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.h +1 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.m +13 -22
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewOptions.h +10 -3
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.h +75 -24
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.m +725 -244
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTypes.h +99 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/NSDictionary+YapDatabase.h +8 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/NSDictionary+YapDatabase.m +19 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.h +1 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.m +12 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.h +1 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.m +3 -3
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabasePrivate.h +43 -21
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapNull.m +4 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.h +3 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.m +5 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.h +4 -4
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.m +84 -93
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.h +21 -19
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.m +381 -209
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.h +131 -21
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.m +587 -267
- data/vendor/Pods/{Pods.bridgesupport → build-iPhoneSimulator/Pods.bridgesupport} +633 -2557
- data/vendor/Pods/build-iPhoneSimulator/libPods.a +0 -0
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.bridgesupport +2 -1
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.h +2 -1
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.m +4 -2
- metadata +80 -108
- data/Gemfile.lock +0 -63
- data/lib/yapper/attachment.rb +0 -48
- data/lib/yapper/document/attachment.rb +0 -26
- data/lib/yapper/sync.rb +0 -134
- data/lib/yapper/sync/data.rb +0 -12
- data/lib/yapper/sync/event.rb +0 -194
- data/lib/yapper/sync/queue.rb +0 -164
- data/spec/integration/all_spec.rb +0 -40
- data/spec/integration/sync_spec.rb +0 -42
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.h +0 -641
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.m +0 -1396
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.h +0 -133
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.m +0 -327
- data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.h +0 -113
- data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.m +0 -321
- data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.h +0 -71
- data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.m +0 -150
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.m +0 -157
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworking.h +0 -43
- data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.h +0 -68
- data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.m +0 -143
- data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.h +0 -370
- data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m +0 -848
- data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.h +0 -89
- data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.m +0 -167
- data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.h +0 -78
- data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.m +0 -191
- data/vendor/Pods/AFNetworking/LICENSE +0 -19
- data/vendor/Pods/AFNetworking/README.md +0 -208
- data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPClient.h +0 -641
- data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperation.h +0 -133
- data/vendor/Pods/BuildHeaders/AFNetworking/AFImageRequestOperation.h +0 -113
- data/vendor/Pods/BuildHeaders/AFNetworking/AFJSONRequestOperation.h +0 -71
- data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
- data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworking.h +0 -43
- data/vendor/Pods/BuildHeaders/AFNetworking/AFPropertyListRequestOperation.h +0 -68
- data/vendor/Pods/BuildHeaders/AFNetworking/AFURLConnectionOperation.h +0 -370
- data/vendor/Pods/BuildHeaders/AFNetworking/AFXMLRequestOperation.h +0 -89
- data/vendor/Pods/BuildHeaders/AFNetworking/UIImageView+AFNetworking.h +0 -78
- data/vendor/Pods/BuildHeaders/Reachability/Reachability.h +0 -109
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DispatchQueueLogFormatter.m +0 -251
- data/vendor/Pods/Headers/AFNetworking/AFHTTPClient.h +0 -641
- data/vendor/Pods/Headers/AFNetworking/AFHTTPRequestOperation.h +0 -133
- data/vendor/Pods/Headers/AFNetworking/AFImageRequestOperation.h +0 -113
- data/vendor/Pods/Headers/AFNetworking/AFJSONRequestOperation.h +0 -71
- data/vendor/Pods/Headers/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
- data/vendor/Pods/Headers/AFNetworking/AFNetworking.h +0 -43
- data/vendor/Pods/Headers/AFNetworking/AFPropertyListRequestOperation.h +0 -68
- data/vendor/Pods/Headers/AFNetworking/AFURLConnectionOperation.h +0 -370
- data/vendor/Pods/Headers/AFNetworking/AFXMLRequestOperation.h +0 -89
- data/vendor/Pods/Headers/AFNetworking/UIImageView+AFNetworking.h +0 -78
- data/vendor/Pods/Headers/Reachability/Reachability.h +0 -109
- data/vendor/Pods/Headers/YapDatabase/YapCache.h +0 -90
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnectionState.h +0 -29
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseDefaults.h +0 -37
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionPrivate.h +0 -440
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewPrivate.h +0 -19
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchPrivate.h +0 -69
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseLogging.h +0 -158
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseManager.h +0 -17
- data/vendor/Pods/Headers/YapDatabase/YapDatabasePrivate.h +0 -424
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +0 -73
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseStatement.h +0 -13
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseString.h +0 -121
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChangePrivate.h +0 -94
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappingsPrivate.h +0 -72
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPage.h +0 -36
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPageMetadata.h +0 -27
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPrivate.h +0 -153
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewRangeOptionsPrivate.h +0 -17
- data/vendor/Pods/Headers/YapDatabase/YapMemoryTable.h +0 -74
- data/vendor/Pods/Headers/YapDatabase/YapNull.h +0 -17
- data/vendor/Pods/Headers/YapDatabase/YapTouch.h +0 -15
- data/vendor/Pods/Headers/____Pods-AFNetworking-prefix.h +0 -17
- data/vendor/Pods/Headers/____Pods-Reachability-prefix.h +0 -5
- data/vendor/Pods/Pods-AFNetworking-Private.xcconfig +0 -5
- data/vendor/Pods/Pods-AFNetworking-dummy.m +0 -5
- data/vendor/Pods/Pods-AFNetworking-prefix.pch +0 -17
- data/vendor/Pods/Pods-AFNetworking.xcconfig +0 -1
- data/vendor/Pods/Pods-Reachability-Private.xcconfig +0 -5
- data/vendor/Pods/Pods-Reachability-dummy.m +0 -5
- data/vendor/Pods/Pods-Reachability-prefix.pch +0 -5
- data/vendor/Pods/Pods-Reachability.xcconfig +0 -1
- data/vendor/Pods/Reachability/LICENCE.txt +0 -24
- data/vendor/Pods/Reachability/README.md +0 -65
- data/vendor/Pods/Reachability/Reachability.h +0 -109
- data/vendor/Pods/Reachability/Reachability.m +0 -527
@@ -3,6 +3,26 @@ module Yapper::Document
|
|
3
3
|
extend MotionSupport::Concern
|
4
4
|
|
5
5
|
module ClassMethods
|
6
|
+
def all(options={})
|
7
|
+
Criteria.new(self, {}, options)
|
8
|
+
end
|
9
|
+
|
10
|
+
def where(criteria, options={})
|
11
|
+
Criteria.new(self, criteria, options)
|
12
|
+
end
|
13
|
+
|
14
|
+
def asc(*fields)
|
15
|
+
Criteria.new(self, {}, {}).sort(fields, :asc)
|
16
|
+
end
|
17
|
+
|
18
|
+
def desc(*fields)
|
19
|
+
Criteria.new(self, {}, {}).sort(fields, :desc)
|
20
|
+
end
|
21
|
+
|
22
|
+
def count
|
23
|
+
all.count
|
24
|
+
end
|
25
|
+
|
6
26
|
def find(id)
|
7
27
|
return nil if id.nil?
|
8
28
|
|
@@ -11,16 +31,6 @@ module Yapper::Document
|
|
11
31
|
attrs ? object_for_attrs(attrs) : nil
|
12
32
|
end
|
13
33
|
|
14
|
-
def all(options={})
|
15
|
-
results = []
|
16
|
-
each_result_proc = proc do |key, attrs, stop|
|
17
|
-
results << object_for_attrs(attrs)
|
18
|
-
end
|
19
|
-
|
20
|
-
db.execute { |txn| txn.enumerateKeysAndObjectsInCollection(self._type, usingBlock: each_result_proc) }
|
21
|
-
results
|
22
|
-
end
|
23
|
-
|
24
34
|
def when(id, &block)
|
25
35
|
observer = nil
|
26
36
|
observer_block = proc do |data|
|
@@ -42,59 +52,117 @@ module Yapper::Document
|
|
42
52
|
end
|
43
53
|
end
|
44
54
|
|
45
|
-
|
46
|
-
values = []; query_str = ''
|
47
|
-
|
48
|
-
# Sort keys so that query string is always the same and is cached
|
49
|
-
criteria.sort.each do |field, value|
|
50
|
-
raise "#{field} is not indexed" if self.indexes[field].nil?
|
51
|
-
|
52
|
-
query_str.blank? ? query_str = "WHERE " : query_str += " AND "
|
53
|
-
query_str += "#{field} = ?"
|
54
|
-
|
55
|
-
# XXX Casting should only happen if the type of the field allows for it
|
56
|
-
value = case value.class.to_s
|
57
|
-
when 'Time'
|
58
|
-
value.to_i
|
59
|
-
else
|
60
|
-
value
|
61
|
-
end
|
62
|
-
values << value
|
63
|
-
end
|
55
|
+
private
|
64
56
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
query_str += ", "
|
71
|
-
else
|
72
|
-
query_str += " ORDER by "
|
73
|
-
end
|
74
|
-
query_str += "#{sort_field} #{direction.upcase}"
|
75
|
-
end
|
76
|
-
else
|
77
|
-
raise "#{option} not a valid option on #where"
|
78
|
-
end
|
79
|
-
end
|
57
|
+
def object_for_attrs(attrs)
|
58
|
+
Object.qualified_const_get(self._type).new(attrs.deep_dup, :new => false, :pristine => true)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
80
62
|
|
81
|
-
|
63
|
+
class Criteria
|
64
|
+
def initialize(klass, criteria, options)
|
65
|
+
@klass = klass
|
66
|
+
@criteria = criteria
|
67
|
+
@options = options
|
68
|
+
end
|
82
69
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
70
|
+
def count
|
71
|
+
count_ptr = Pointer.new(:uint)
|
72
|
+
@klass.db.execute { |txn| txn.ext("#{@klass._type}_IDX").getNumberOfRows(count_ptr, matchingQuery: query) }
|
73
|
+
count_ptr.value
|
74
|
+
end
|
75
|
+
|
76
|
+
def first
|
77
|
+
asc(:id).limit(1).to_a.first
|
78
|
+
end
|
79
|
+
|
80
|
+
def last
|
81
|
+
desc(:id).limit(1).to_a.first
|
82
|
+
end
|
87
83
|
|
88
|
-
|
84
|
+
def to_a
|
85
|
+
results = []
|
89
86
|
|
90
|
-
|
87
|
+
each_result_proc = proc do |collection, key, attrs, stop|
|
88
|
+
results << object_for_attrs(attrs)
|
91
89
|
end
|
92
90
|
|
93
|
-
|
91
|
+
@klass.db.execute { |txn| txn.ext("#{@klass._type}_IDX").enumerateKeysAndObjectsMatchingQuery(query, usingBlock: each_result_proc) }
|
94
92
|
|
95
|
-
|
96
|
-
|
93
|
+
results
|
94
|
+
end
|
95
|
+
|
96
|
+
def each(&block)
|
97
|
+
to_a.each(&block)
|
98
|
+
end
|
99
|
+
|
100
|
+
def where(criteria)
|
101
|
+
self.class.new(@klass, @criteria.merge(criteria), @options)
|
102
|
+
end
|
103
|
+
|
104
|
+
def limit(limit)
|
105
|
+
self.class.new(@klass, @criteria, @options.merge(:limit => limit))
|
106
|
+
end
|
107
|
+
|
108
|
+
def sort(fields, direction)
|
109
|
+
order = @options[:order].to_a + fields.map { |f| [f,direction] }
|
110
|
+
self.class.new(@klass, @criteria, @options.merge(:order => order))
|
111
|
+
end
|
112
|
+
|
113
|
+
def asc(*fields)
|
114
|
+
sort(fields, :asc)
|
115
|
+
end
|
116
|
+
|
117
|
+
def desc(*fields)
|
118
|
+
sort(fields, :desc)
|
119
|
+
end
|
120
|
+
|
121
|
+
private
|
122
|
+
|
123
|
+
def query
|
124
|
+
values = []; query_str = ''
|
125
|
+
|
126
|
+
# Sort keys so that query string is always the same and is cached
|
127
|
+
@criteria.sort.each do |field, value|
|
128
|
+
raise "#{field} is not indexed" if @klass.indexes[field].nil?
|
129
|
+
|
130
|
+
query_str.blank? ? query_str = "WHERE " : query_str += " AND "
|
131
|
+
query_str += "#{field} = ?"
|
132
|
+
|
133
|
+
# XXX Casting should only happen if the type of the field allows for it
|
134
|
+
value = case value.class.to_s
|
135
|
+
when 'Time'
|
136
|
+
value.to_i
|
137
|
+
else
|
138
|
+
value
|
139
|
+
end
|
140
|
+
values << value
|
97
141
|
end
|
142
|
+
|
143
|
+
@options.each do |option, params|
|
144
|
+
case option
|
145
|
+
when :order
|
146
|
+
params.each do |sort_field, direction|
|
147
|
+
if query_str.include?("ORDER by")
|
148
|
+
query_str += ", "
|
149
|
+
else
|
150
|
+
query_str += " ORDER by "
|
151
|
+
end
|
152
|
+
query_str += "#{sort_field} #{direction.upcase}"
|
153
|
+
end
|
154
|
+
when :limit
|
155
|
+
query_str += " LIMIT #{params}"
|
156
|
+
else
|
157
|
+
raise "#{option} not a valid option on #where"
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
YapDatabaseQuery.alloc.initWithQueryString(query_str, queryParameters: values)
|
162
|
+
end
|
163
|
+
|
164
|
+
def object_for_attrs(attrs)
|
165
|
+
Object.qualified_const_get(@klass._type).new(attrs.deep_dup, :new => false, :pristine => true)
|
98
166
|
end
|
99
167
|
end
|
100
168
|
end
|
data/lib/yapper/extensions.rb
CHANGED
@@ -41,40 +41,28 @@ class Time
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
class Object
|
45
|
-
def as_json
|
46
|
-
self
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
44
|
class Hash
|
51
|
-
def
|
52
|
-
|
53
|
-
self.each { |k,v| hash[k] = v.as_json }
|
54
|
-
hash
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
class NSDictionary
|
59
|
-
def as_json
|
60
|
-
to_hash.as_json
|
45
|
+
def to_canonical
|
46
|
+
self.keys.to_canonical + self.values.to_canonical
|
61
47
|
end
|
62
48
|
end
|
63
49
|
|
64
50
|
class Array
|
65
|
-
def
|
66
|
-
self.map { |v| v.
|
51
|
+
def to_canonical
|
52
|
+
self.map { |v| v.class.to_s == 'Class' ? v.to_s : v}.map(&:to_canonical).sort.join
|
67
53
|
end
|
68
54
|
end
|
69
55
|
|
70
|
-
class
|
71
|
-
def
|
72
|
-
self
|
56
|
+
class String
|
57
|
+
def to_canonical
|
58
|
+
self
|
73
59
|
end
|
74
60
|
end
|
75
61
|
|
76
|
-
class
|
77
|
-
def
|
78
|
-
|
62
|
+
class Symbol
|
63
|
+
def to_canonical
|
64
|
+
to_s
|
79
65
|
end
|
80
66
|
end
|
67
|
+
|
68
|
+
class Boolean; end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
motion_require 'yapper'
|
2
|
+
|
3
|
+
module Yapper::Settings
|
4
|
+
PREFIX = 'yapper-'
|
5
|
+
extend self
|
6
|
+
|
7
|
+
mattr_accessor :db_version
|
8
|
+
|
9
|
+
def get(key)
|
10
|
+
value = storage.objectForKey(storage_key(key))
|
11
|
+
|
12
|
+
# RubyMotion currently has a bug where the strings returned from
|
13
|
+
# standardUserDefaults are missing some methods (e.g. to_data).
|
14
|
+
# And because the returned object is slightly different than a normal
|
15
|
+
# String, we can't just use `value.is_a?(String)`
|
16
|
+
value.class.to_s == 'String' ? value.dup : value
|
17
|
+
end
|
18
|
+
|
19
|
+
def set(key, value)
|
20
|
+
storage.setObject(value, forKey: storage_key(key))
|
21
|
+
storage.synchronize
|
22
|
+
end
|
23
|
+
|
24
|
+
def delete(key)
|
25
|
+
storage.removeObjectForKey(storage_key(key))
|
26
|
+
storage.synchronize
|
27
|
+
end
|
28
|
+
|
29
|
+
def purge
|
30
|
+
storage.dictionaryRepresentation.keys.each { |key| self.delete(key.gsub(/^#{PREFIX}/,'')) if key =~ /^#{PREFIX}/ }
|
31
|
+
storage.synchronize
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def storage_key(key)
|
37
|
+
"#{PREFIX}#{key}"
|
38
|
+
end
|
39
|
+
|
40
|
+
def storage
|
41
|
+
NSUserDefaults.standardUserDefaults
|
42
|
+
end
|
43
|
+
end
|
data/lib/yapper/timestamps.rb
CHANGED
data/lib/yapper/version.rb
CHANGED
File without changes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
describe '
|
1
|
+
describe 'Criteria' do
|
2
2
|
before do
|
3
3
|
class WhereDocument
|
4
4
|
include Yapper::Document
|
@@ -6,8 +6,10 @@ describe '#where' do
|
|
6
6
|
field :field1, :type => String
|
7
7
|
field :field2, :type => Integer
|
8
8
|
field :field3, :type => Time
|
9
|
+
field :field4, :type => String
|
10
|
+
field :field5, :type => Boolean
|
9
11
|
|
10
|
-
index :field1, :field2, :field3
|
12
|
+
index :field1, :field2, :field3, :field5
|
11
13
|
end
|
12
14
|
class AnotherWhereDocument
|
13
15
|
include Yapper::Document
|
@@ -22,16 +24,32 @@ describe '#where' do
|
|
22
24
|
after { Object.send(:remove_const, 'WhereDocument') }
|
23
25
|
after { Object.send(:remove_const, 'AnotherWhereDocument') }
|
24
26
|
|
27
|
+
describe 'when changing the index definition' do
|
28
|
+
it "reindexes the fields" do
|
29
|
+
WhereDocument.create(:field1 => 'field1', :field4 => 'field4')
|
30
|
+
|
31
|
+
lambda {
|
32
|
+
WhereDocument.where(:field4 => 'field4').first
|
33
|
+
}.should.raise
|
34
|
+
|
35
|
+
WhereDocument.class_eval do
|
36
|
+
index :field4
|
37
|
+
end
|
38
|
+
|
39
|
+
WhereDocument.where(:field4 => 'field4').count.should == 1
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
25
43
|
describe 'with no documents created' do
|
26
44
|
it 'returns []' do
|
27
|
-
WhereDocument.where(:field1 => 'xxx').should == []
|
45
|
+
WhereDocument.where(:field1 => 'xxx').to_a.should == []
|
28
46
|
end
|
29
47
|
end
|
30
48
|
|
31
49
|
describe 'when searching with a non indexed field' do
|
32
50
|
it 'raises' do
|
33
51
|
lambda {
|
34
|
-
AnotherWhereDocument.where(:field2 => 'xxx')
|
52
|
+
AnotherWhereDocument.where(:field2 => 'xxx').first
|
35
53
|
}.should.raise
|
36
54
|
end
|
37
55
|
end
|
@@ -42,10 +60,54 @@ describe '#where' do
|
|
42
60
|
WhereDocument.create(:field1 => 'field1_value', :field2 => 2)
|
43
61
|
WhereDocument.create(:field1 => 'field1_value', :field2 => 3)
|
44
62
|
WhereDocument.create(:field1 => 'field1_value', :field2 => 4)
|
63
|
+
WhereDocument.create(:field1 => 'field1_other_value', :field2 => 1)
|
45
64
|
WhereDocument.create(:field1 => 'field1_other_value', :field2 => 2, :field3 => @now)
|
65
|
+
WhereDocument.create(:field5 => true)
|
46
66
|
AnotherWhereDocument.create(:field1 => 'field1_value', :field2 => 2)
|
47
67
|
end
|
48
68
|
|
69
|
+
describe '#all' do
|
70
|
+
it 'returns all documents' do
|
71
|
+
WhereDocument.all.to_a.count.should == 6
|
72
|
+
end
|
73
|
+
|
74
|
+
describe 'with a document that has no indexes' do
|
75
|
+
before do
|
76
|
+
class NoIndexDocument
|
77
|
+
include Yapper::Document
|
78
|
+
|
79
|
+
field :field1
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'still returns' do
|
84
|
+
NoIndexDocument.all.count.should == 0
|
85
|
+
NoIndexDocument.all.to_a.count.should == 0
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
describe '#count' do
|
91
|
+
it 'returns all documents' do
|
92
|
+
WhereDocument.count.should == 6
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
describe 'chaining' do
|
97
|
+
it 'where, all' do
|
98
|
+
WhereDocument.all.where(:field1 => 'field1_value').where(:field2 => 2).count.should == 1
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'where, desc, asc' do
|
102
|
+
WhereDocument.where(:field1 => 'field1_value').asc(:field2).first.field2.should == 2
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'desc, asc' do
|
106
|
+
WhereDocument.where(:field1 => 'field1_value').desc(:field1).desc(:field2).first.field2.should == 4
|
107
|
+
WhereDocument.where(:field1 => 'field1_value').desc(:field1).asc(:field2).first.field2.should == 2
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
49
111
|
it 'can search by string' do
|
50
112
|
WhereDocument.where(:field1 => 'field1_value').count.should == 3
|
51
113
|
end
|
@@ -58,12 +120,17 @@ describe '#where' do
|
|
58
120
|
WhereDocument.where(:field3 => @now).count.should == 1
|
59
121
|
end
|
60
122
|
|
123
|
+
it 'can search by boolean' do
|
124
|
+
WhereDocument.where(:field5 => true).count.should == 1
|
125
|
+
WhereDocument.where(:field5 => false).count.should == 0
|
126
|
+
end
|
127
|
+
|
61
128
|
it 'returns [] when looking up a non-existant doc' do
|
62
|
-
WhereDocument.where(:field1 => 'xxx').should == []
|
129
|
+
WhereDocument.where(:field1 => 'xxx').to_a.should == []
|
63
130
|
end
|
64
131
|
|
65
132
|
it 'can select docments matching on multiple fields' do
|
66
|
-
WhereDocument.where(:field1 => 'field1_value', :field2 => 2).count.should == 1
|
133
|
+
WhereDocument.where(:field1 => 'field1_value', :field2 => 2).to_a.count.should == 1
|
67
134
|
end
|
68
135
|
|
69
136
|
describe 'when documents are updated' do
|
@@ -104,13 +171,14 @@ describe '#where' do
|
|
104
171
|
WhereDocument.create(:field1 => 'apple')
|
105
172
|
WhereDocument.create(:field1 => 'squash')
|
106
173
|
WhereDocument.create(:field1 => 'carrot')
|
174
|
+
WhereDocument.create(:field1 => nil)
|
107
175
|
end
|
108
176
|
it 'can sort documents ascending' do
|
109
|
-
WhereDocument.
|
177
|
+
WhereDocument.asc(:field1).to_a.collect(&:field1).should == [nil, 'apple', 'carrot', 'squash']
|
110
178
|
end
|
111
179
|
|
112
180
|
it 'can sort documents descending' do
|
113
|
-
WhereDocument.
|
181
|
+
WhereDocument.desc(:field1).to_a.collect(&:field1).should == ['squash', 'carrot', 'apple', nil]
|
114
182
|
end
|
115
183
|
end
|
116
184
|
|
@@ -121,11 +189,11 @@ describe '#where' do
|
|
121
189
|
WhereDocument.create(:field3 => Time.utc(2013,1,1,14,00))
|
122
190
|
end
|
123
191
|
it 'can sort documents ascending' do
|
124
|
-
WhereDocument.
|
192
|
+
WhereDocument.asc(:field3).to_a.collect(&:field3).should == [Time.utc(2013,1,1,9,00), Time.utc(2013,1,1,10,00), Time.utc(2013,1,1,14,00)]
|
125
193
|
end
|
126
194
|
|
127
195
|
it 'can sort documents descending' do
|
128
|
-
WhereDocument.
|
196
|
+
WhereDocument.desc(:field3).to_a.collect(&:field3).should == [Time.utc(2013,1,1,14,00), Time.utc(2013,1,1,10,00), Time.utc(2013,1,1,9,00)]
|
129
197
|
end
|
130
198
|
end
|
131
199
|
end
|