Parsistence 0.3.9 → 0.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Parsistence.gemspec +2 -2
- data/README.md +1 -1
- data/lib/Parsistence/Model.rb +7 -7
- data/lib/Parsistence/Query.rb +11 -11
- data/lib/Parsistence/version.rb +1 -1
- metadata +1 -3
data/Parsistence.gemspec
CHANGED
@@ -4,8 +4,8 @@ require File.expand_path('../lib/Parsistence/version', __FILE__)
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "Parsistence"
|
6
6
|
s.version = Parsistence::VERSION
|
7
|
-
s.authors = ["Jamon Holmgren", "Silas J. Matson"
|
8
|
-
s.email = ["jamon@clearsightstudio.com", "silas@clearsightstudio.com"
|
7
|
+
s.authors = ["Jamon Holmgren", "Silas J. Matson"]
|
8
|
+
s.email = ["jamon@clearsightstudio.com", "silas@clearsightstudio.com"]
|
9
9
|
s.homepage = "https://github.com/clearsightstudio/Parsistence"
|
10
10
|
s.summary = %q{Your models on RubyMotion and Parse in a persistence.js style pattern.}
|
11
11
|
s.description = %q{Your models on RubyMotion and Parse in a persistence.js style pattern.}
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# About
|
2
2
|
|
3
|
-
Parsistence provides an
|
3
|
+
Parsistence provides an ActiveRecord/Persistence.js pattern to your Parse.com models on RubyMotion.
|
4
4
|
It's an early fork from [ParseModel](https://github.com/adelevie/ParseModel) by
|
5
5
|
Alan deLevie but goes a different direction with its implementation.
|
6
6
|
|
data/lib/Parsistence/Model.rb
CHANGED
@@ -138,11 +138,11 @@ module Parsistence
|
|
138
138
|
|
139
139
|
# Sets the attributes of the Model
|
140
140
|
#
|
141
|
-
# @param [Hash]
|
141
|
+
# @param [Hash] attrs to set on the Model
|
142
142
|
# @return [Hash] that you gave it
|
143
143
|
# @note will throw an error if a key is invalid
|
144
|
-
def attributes=(
|
145
|
-
|
144
|
+
def attributes=(attrs)
|
145
|
+
attrs.each do |k, v|
|
146
146
|
if v.respond_to?(:each) && !v.is_a?(PFObject)
|
147
147
|
self.attributes = v
|
148
148
|
elsif self.respond_to? "#{k}="
|
@@ -260,14 +260,14 @@ module Parsistence
|
|
260
260
|
# set the fields for the current Model
|
261
261
|
# used in method_missing
|
262
262
|
#
|
263
|
-
# @param [Symbol] one or more fields
|
263
|
+
# @param [Symbol] args one or more fields
|
264
264
|
def fields(*args)
|
265
265
|
args.each {|arg| field(arg)}
|
266
266
|
end
|
267
267
|
|
268
268
|
# set a field for the current Model
|
269
269
|
#
|
270
|
-
# @param [Symbol] field
|
270
|
+
# @param [Symbol] name of field
|
271
271
|
# (see #fields)
|
272
272
|
def field(name)
|
273
273
|
@fields ||= [:objectId]
|
@@ -282,14 +282,14 @@ module Parsistence
|
|
282
282
|
# set the relations for the current Model
|
283
283
|
# used in method_missing
|
284
284
|
#
|
285
|
-
# @param [Symbol] one or more relations
|
285
|
+
# @param [Symbol] args one or more relations
|
286
286
|
def relations(*args)
|
287
287
|
args.each { |arg| relation(arg)}
|
288
288
|
end
|
289
289
|
|
290
290
|
# set a relation for the current Model
|
291
291
|
#
|
292
|
-
# @param [Symbol] relation
|
292
|
+
# @param [Symbol] name of relation
|
293
293
|
# (see #relations)
|
294
294
|
def relation(name)
|
295
295
|
@relations ||= []
|
data/lib/Parsistence/Query.rb
CHANGED
@@ -234,8 +234,8 @@ module Parsistence
|
|
234
234
|
|
235
235
|
# Limit number of results
|
236
236
|
#
|
237
|
-
# @param [Integer] offset
|
238
|
-
# @param [Integer] number to limit, if not passed, first arg is used for limit
|
237
|
+
# @param [Integer] offset value
|
238
|
+
# @param [Integer] number of results to limit, if not passed, first arg is used for limit
|
239
239
|
# @return [Object] self
|
240
240
|
def limit(offset, number = nil)
|
241
241
|
if number.nil?
|
@@ -249,7 +249,7 @@ module Parsistence
|
|
249
249
|
|
250
250
|
# Order query results
|
251
251
|
#
|
252
|
-
# @param [Hash]
|
252
|
+
# @param [Hash] fields - order-direction
|
253
253
|
# @return [Object] self
|
254
254
|
def order(*fields)
|
255
255
|
fields.each do |field|
|
@@ -260,7 +260,7 @@ module Parsistence
|
|
260
260
|
|
261
261
|
# Query for fields where key == value
|
262
262
|
#
|
263
|
-
# @param [Hash]
|
263
|
+
# @param [Hash] fields key-value pairs
|
264
264
|
# @return [Object] self
|
265
265
|
def eq(*fields)
|
266
266
|
fields.each do |field|
|
@@ -271,7 +271,7 @@ module Parsistence
|
|
271
271
|
|
272
272
|
# Query for fields where key != value
|
273
273
|
#
|
274
|
-
# @param [Hash]
|
274
|
+
# @param [Hash] fields key-value pairs
|
275
275
|
# @return [Object] self
|
276
276
|
def notEq(*fields)
|
277
277
|
fields.each do |field|
|
@@ -282,7 +282,7 @@ module Parsistence
|
|
282
282
|
|
283
283
|
# Query for fields where key < value
|
284
284
|
#
|
285
|
-
# @param [Hash]
|
285
|
+
# @param [Hash] fields key-value pairs
|
286
286
|
# @return [Object] self
|
287
287
|
def lt(*fields)
|
288
288
|
fields.each do |field|
|
@@ -293,7 +293,7 @@ module Parsistence
|
|
293
293
|
|
294
294
|
# Query for fields where key > value
|
295
295
|
#
|
296
|
-
# @param [Hash]
|
296
|
+
# @param [Hash] fields key-value pairs
|
297
297
|
# @return [Object] self
|
298
298
|
def gt(*fields)
|
299
299
|
fields.each do |field|
|
@@ -304,7 +304,7 @@ module Parsistence
|
|
304
304
|
|
305
305
|
# Query for fields where key is in an array of values
|
306
306
|
#
|
307
|
-
# @param [Hash]
|
307
|
+
# @param [Hash] fields key-value pairs, value is an array
|
308
308
|
# @return [Object] self
|
309
309
|
def in(*fields)
|
310
310
|
fields.each do |field|
|
@@ -315,7 +315,7 @@ module Parsistence
|
|
315
315
|
|
316
316
|
# Query for fields where key <= value
|
317
317
|
#
|
318
|
-
# @param [Hash]
|
318
|
+
# @param [Hash] fields key-value pairs
|
319
319
|
# @return [Object] self
|
320
320
|
def lte(*fields)
|
321
321
|
fields.each do |field|
|
@@ -326,7 +326,7 @@ module Parsistence
|
|
326
326
|
|
327
327
|
# Query for fields where key >= value
|
328
328
|
#
|
329
|
-
# @param [Hash]
|
329
|
+
# @param [Hash] fields key-value pairs
|
330
330
|
# @return [Object] self
|
331
331
|
def gte(*fields)
|
332
332
|
fields.each do |field|
|
@@ -337,7 +337,7 @@ module Parsistence
|
|
337
337
|
|
338
338
|
# Include related object in query
|
339
339
|
#
|
340
|
-
# @param [Hash]
|
340
|
+
# @param [Hash] fields
|
341
341
|
# @return [Object] self
|
342
342
|
def includes(*fields)
|
343
343
|
fields.each do |field|
|
data/lib/Parsistence/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Parsistence
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jamon Holmgren
|
9
9
|
- Silas J. Matson
|
10
|
-
- Alan deLevie
|
11
10
|
autorequire:
|
12
11
|
bindir: bin
|
13
12
|
cert_chain: []
|
@@ -17,7 +16,6 @@ description: Your models on RubyMotion and Parse in a persistence.js style patte
|
|
17
16
|
email:
|
18
17
|
- jamon@clearsightstudio.com
|
19
18
|
- silas@clearsightstudio.com
|
20
|
-
- adelevie@gmail.com
|
21
19
|
executables: []
|
22
20
|
extensions: []
|
23
21
|
extra_rdoc_files: []
|