poros 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -2
- data/lib/poros/info.rb +13 -11
- data/lib/poros/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7ec142e948b6710c081338f06724f8563917a217fa8f87311114e51eed3bcc9
|
4
|
+
data.tar.gz: adc6edc71a8151feb56cd5ceb642d973afc9c160d1ce90d7afb7d535332b45df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41f991b29ee7c2e91e959a07c87d2e5fefe296c1467db50adfb586710656b29a9963aa97d631c8b479a5c89e2e58f72e2cb19bd0278020d1c1ef59b96a50044d
|
7
|
+
data.tar.gz: 02f9a28651945c27e73564a1d9d003503e3336f771c18706dd3a9de23fd458d40c5d013a2dfe2b4f34f2a6f3c84909d88e20a59ecb464a2abfc3504f78e3da50
|
data/README.md
CHANGED
@@ -63,8 +63,21 @@ save to the default of `./db/#{self}`. If you do re-define it you _must_
|
|
63
63
|
seperate each model into it's own folder or it will have _lots_ of issues.
|
64
64
|
|
65
65
|
`.where` acts a bit like ActiveRecord but it's not currently chainable (I plan
|
66
|
-
to do that in the future though) and
|
67
|
-
|
66
|
+
to do that in the future though) and takes exact matches, regexs, arrays, or
|
67
|
+
lambdas in any combination.
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
# Valid examples
|
71
|
+
Widget.where(name: 'sprocket')
|
72
|
+
Widget.where(name: /spr.*cket/)
|
73
|
+
Widget.where(order: -> value { value > 3 })
|
74
|
+
Widget.where(order: [1, 5, 8], active: true)
|
75
|
+
|
76
|
+
# Invalid examples
|
77
|
+
Widget.where(name: 'sprocket', name: 'cog') # can't check same value twice, use arrays
|
78
|
+
Widget.where(order: 1).where(name: 'cog') # can't chain wheres
|
79
|
+
```
|
80
|
+
|
68
81
|
|
69
82
|
`.find` takes the `#uuid` which is generated by Poros and returns the single record.
|
70
83
|
|
data/lib/poros/info.rb
CHANGED
@@ -1,16 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module Poros
|
2
|
+
class Info
|
3
|
+
def initialize(object)
|
4
|
+
@object = object
|
5
|
+
end
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
def file_path
|
8
|
+
@object.class.file_path(@object.uuid)
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
def to_h
|
12
|
+
@object.class.poro_attrs.map { |column|
|
13
|
+
[column, @object.send(column.to_s)]
|
14
|
+
}.to_h
|
15
|
+
end
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
data/lib/poros/version.rb
CHANGED